Efficient data structure design
Posted
by Sway
on Stack Overflow
See other posts from Stack Overflow
or by Sway
Published on 2010-05-11T23:12:55Z
Indexed on
2010/05/12
0:54 UTC
Read the original article
Hit count: 303
Hi there,
I need to match a series of user inputed words against a large dictionary of words (to ensure the entered value exists).
So if the user entered:
"orange" it should match an entry "orange' in the dictionary.
Now the catch is that the user can also enter a wildcard or series of wildcard characters like say
"or__ge" which would also match "orange"
The key requirements are:
* this should be as fast as possible.
* use the smallest amount of memory to achieve it.
If the size of the word list was small I could use a string containing all the words and use regular expressions.
however given that the word list could contain potentially hundreds of thousands of enteries I'm assuming this wouldn't work.
So is some sort of 'tree' be the way to go for this...?
Any thoughts or suggestions on this would be totally appreciated!
Thanks in advance, Matt
© Stack Overflow or respective owner