Solved

How to implement an oxford english dictionary?

Posted on 2010-09-06
4
1,250 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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
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 …

773 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