I have been struggling to solve pset 5 speller.c for a few weeks now and I don't know what I'm doing wrong in my code as it is not passing check50 and would really appreciate if someone could help me with this problem set.


code removed for academic honesty

It would be great if you could specify what exactly does not work. I immediately spotted a problem with size, please comment if there's another problem.


        if(pointer == NULL)
            return 0;

as there's no reason why an empty list (for example no word in dict that starts with x) would determine the dict is empty.

An easier approach to size is to count the words you're loading, store that in a global variable, and report that number instead of walking the actual dictionary.

Your hash table size is used inconsistently, sometimes for 26, sometimes 27 elements, but that's probably ok since you don't use index 26. Maybe store the size of the hash table within a global constant and use that one instead of the actual number. This also has the benefit that you could later increase table size for using a more complex hash function, and not worry too much about changing the number in multiple places.

  • Thanks so much my code is working now
    – aash123
    Nov 3 '17 at 13:30

You must log in to answer this question.

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