Solved

implementation of Computer Dictionary

Posted on 2004-04-24
3
833 Views
Last Modified: 2010-05-18
Hi,
Now a days i have a task to do related to the implementation of Computer dictionary using any data structures. i am an intermediate programmer and also want to finish it off as quickly as possible, so would u plz tell me which data structure i should use to implement the above said concept. i have studied stacks, queues, linked list, trees. i am also planing to use the File concept. if u can help me in shape of any sample code, that would be even better...

with Regards,

Ahmer.

0
Comment
Question by:ahit
  • 2
3 Comments
 
LVL 9

Accepted Solution

by:
ankuratvb earned 125 total points
ID: 10907339
It depends to what depth you want to approach the problem.

The simplest would be create word-definition pairs and store in two double dimensional arrays.

Then,according to the word entered,find the corresponding meaning by looking up the corresponding index on the definition array.

If you keep the word-defn pairs sorted on word,you can do binary search to improve search speed.

for e.g.
char word[MAX_ENTRIES][MAX_LENGTH];
char defn[MAX_ENTRIES][MAX_LENGTH];

lets say,you find the word wanted at word[102];
the defn would be defn[102];
Simple.

Store the words and meaning in a file and load them into this array at program startup.
You could also store the number of words as well.
Then you can define your array length dynamincally using malloc().

For another idea using trees,see here:
http://oldlook.experts-exchange.com:8080/Programming/Programming_Languages/C/Q_20684111.html
0
 
LVL 2

Expert Comment

by:anupvijay
ID: 10919743
Another idea would be to use a hash table. Although I myself have not had any experience with them but I hear that
it is quite helpful in store and search kind of applications.

If any one else can shed some more light it might help all of us.

Cheers.
0
 
LVL 2

Expert Comment

by:anupvijay
ID: 10919813
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

Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use nested-loops in the C programming language.
The goal of this video is to provide viewers with basic examples to understand opening and reading files in the C programming language.

708 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

13 Experts available now in Live!

Get 1:1 Help Now