Solved

How to implement an oxford english dictionary?

Posted on 2010-09-06
4
1,245 Views
Last Modified: 2012-06-21
Which data structure would be the most efficient to implement this - HashTable/Tree?
0
Comment
Question by:malakheti
  • 2
4 Comments
 
LVL 12

Expert Comment

by:w00te
ID: 33613617
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
 
LVL 12

Accepted Solution

by:
w00te earned 500 total points
ID: 33613640
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
 
LVL 3

Expert Comment

by:firozmusthafa
ID: 33614223
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
 

Author Closing Comment

by:malakheti
ID: 33624766
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

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now