Click here to Skip to main content
15,884,176 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to make a key fuzzy lookup the hash table, not Traversal.
eg: word 'EA' lookup Key 'EAS','EAGGG' etc. in the hash
Posted
Updated 11-Jan-12 5:52am
v2

1 solution

To start off, I'll have to admit I've never tried something like this, but I think I can direct you a bit. If you have a Hashtable (or even a Dictionary), they store values on a 1:1 basis (i.e. one key, one value).

So, the only way to approach this problem as you've stated it without resorting to a different data structure that might be more appropriate, you would have to iterate over each key in the table comparing it with your 'fuzzy' compare method. You could also try seeding the hashtable with possible values to map the multiple keys to the same value, but this would require a limited set of valid values it would map to.

Otherwise, you'll need to look at different data structure that would be more suited to your needs.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900