I'm having some trouble in implementing load().

I thought I should make a trie, but could not understand how to.

Then I thought I'd make a hash table, but I had no idea how to.

The only way I can think of is counting the words in the dictionary and create an array[word count], then with a for loop and fscanf() fill in the array with strings from the dictionary. I was thinking I could access the values with a sorting algorithm.

But I know this is not how I'm supposed to complete the assignment because all the lectures, sections, and shorts were about other data structures, but I'm lost and I don't know where to start from. I understand the concept of tries, hashing, and trees, but when it comes to the implementation I feel helpless.

I looked at https://study.cs50.net/, but other than very little pseudocode and theoretical explanations there's nothing about the actual implementation of these kinds of data structures.

Any help or resource would be of great help, I don't want to just look up the solutions on GitHub, I would like to understand it on my own.

  • try looking into structs
    – JV305
    Nov 27 '15 at 19:10

Can the dictionary be done using a regular array? Yes. Should you? NO! Structures are a very important tool in programming, one you should learn if you are at all serious about learning to program. This pset does a great job of covering the main concepts of structures and linked lists. You should really try to do either a tree or a trie, if not both!

If you're really not getting it, you should go to one of the live discussion forums, such as https://cs50x.slack.com and ask for help. (Please go to the #speller room for this one.) Someone will be happy to get you on track and give you some personalized guidance. This is definitely a case where a two-way discussion will be more productive for you.

IF this answers your question, please click the check mark to accept the answer. Let's keep up on forum maintenance. ;-)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .