1

I've just started this pset and only implemented load.

So how do I know if my load function actually loads the dictionary and there are words in the hashtable without implementing the other functions yet? Do I just rely on the time taken to load and if program returns "could not load"?

Sorry to sound dumb!

7
  • Your question is not dumb! It's a perfectly good question and has better structure and meaning than many others I've seen. And even if it was dumb don't worry. It's the moderators' job to tell you what is wrong with your question and help you fix it. – ChrisG Jul 20 '15 at 8:51
  • Another question. When I malloc the nodes used for the linked list do I then free them at the end of load? I assume that is a task for unload? – VishG Jul 21 '15 at 19:52
  • No. You should unload the nodes, only when the whole checking has finished. If you unload the nodes, hence the words from memory, how are going to test the words you read from the text file? – ChrisG Jul 21 '15 at 19:54
  • Ok got that. Thanks! Also if there are collisions, can I assume that appending them at the end of the linked list pertaining to that hash value will make that linked list sorted, since the dictionary is already sorted? – VishG Jul 21 '15 at 20:28
  • Yes you can assume that. The last item read with a certain hash value, will be appended at the end of the linked list depending on that hash value. So the words will be sorted in each linked list. – ChrisG Jul 21 '15 at 20:31
2

I think you should just follow the steps described, write your code. Compile it. Run it. If it runs without errors or segmentation faults keep going to the next function. If you want though to be sure you could use gdb and run your program line by line. If you see that it repeats the reading of the words in the dictionary, and it executes the commands it should, you are probably ok to continue.

2

Also, implement size, which is a pretty simple function, and see how many words your function loads. My original load function only took in the first word, even though it had seemed like it would work fine when I wrote and reviewed it.

You must log in to answer this question.

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