Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1267
  • Last Modified:

How to implement an oxford english dictionary?

Which data structure would be the most efficient to implement this - HashTable/Tree?
0
malakheti
Asked:
malakheti
  • 2
1 Solution
 
w00teCommented:
I'm unsure as to why you wouldn't just use a C# dictiaonry object.  It has an internal hash table representation which is extremely efficient (kinda the point).  Was there a reason you were looking to implement it yourself? (and as you can tell, my answer is definitely hash table over tree :) ).
From MSDN: "The Dictionary<(Of <(TKey, TValue>)>) generic class provides a mapping from a set of keys to a set of values. Each addition to the dictionary consists of a value and its associated key. Retrieving a value by using its key is very fast, close to O(1), because the Dictionary<(Of <(TKey, TValue>)>) class is implemented as a hash table."
http://msdn.microsoft.com/en-us/library/xfhwa508.aspx
-w00te
0
 
w00teCommented:
Oh, and by the way- in case you start looking for the multiple values per dictionary key issue, you can handle it pretty easily with:
Dictionary<String,List<Customer>>
This thread covers various options for that:
http://stackoverflow.com/questions/569903/multi-value-dictionary 
0
 
firozmusthafaCommented:
you could use any of the basic datastructures ranging from multiilevel hashes to dynamic hashes, refer a good datastructures text book or just google it!
0
 
malakhetiAuthor Commented:
This is exactly what I wanted to know about. I knew hashtable is most efficient for lookup, but was not sure about the multiple values.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now