I'm starting Problem Set nb 5 and just need a couple more specifications to begin my implementation of LOAD.

Is it good to assume that a lexicographically sorted dictionary corresponds to a dictionary sorted in alphabetical order top to bottom?

Also, I'm not certain if I understand well what LOAD is really supposed to do. I think I must open a file called DICTIONARY and inputted through the command line of the main function and then, place all sorted words in the most efficient way that will allow us to find a specific word in the most rapidly possible.

Thanks for your help.


Yes, the dictionary file is expected to be a file that contains a sorted list of words, one per line. Your mission is, indeed, to create in the LOAD function, code that will take those words and insert them into a tree or trie in memory so that you can check words from a test file against them later. LOAD will either take a command line parameter that specifies the dictionary file, or will use the default, as specified in the assignment and is coded in the source code file.

In essence, yes, you have the idea.

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

  • Thanks for precisions! Now I have written my implementation of LOAD, I want test my code. I have tried : jharvard@appliance (~/Dropbox/pset5): ./speller ~cs50/pset5/dictionaries/small austin powers.txt but it doesn't work. How I'm supposed to be able to test LOAD if I have not yet implemented the other subfunctions?
    – CharlesD89
    Nov 8 '15 at 2:57
  • Well, you could write some temp code to print out the tree, but you might be as far ahead to just write search and test them both. Also, I suggest that you test with a small dictionary of about 3 or 4 words as both the dictionary and the text file to check. By doing that, you know that no words should be misspelled and the word count should be however many words are in the file.
    – Cliff B
    Nov 8 '15 at 3:02

You must log in to answer this question.

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