When running speller with the small dictionary and ralph.txt as the text, my program correctly outputs the misspelled words and outputs the statistics (i.e. time in load, number of words in dictionary etc.). It also behaves this way for a large text (i.e. kjv).
I have also tested with a dictionary containing 2572 words and the program manages to produce a correct output for ralph. But for kjv it outputs "MISPELLED WORDS" followed by some words and then has to be ended with ctrl c.
This also happens when I run the program with the large dictionary. However, the only output is "MISPELLED WORDS" for both ralph and kjv and I have to press ctrl c to end the program (see below)
~/workspace/pset5/speller/ $ ./speller dictionaries/large texts/ralph.txt
MISSPELLED WORDS
^C
what could be the problem? Help would be very much appreciated!
(I have completed all four functions and the program passes check50 but given the output problem described above, the program can't be working correctly).
EDIT: code removed to comply with academic honesty
apple
work fairly quickly, butzebra
takes forever? There's always debug50, and valgrind has been known to give excellent hints.MISSPELLED WORDS
, there's one call tocheck
for every word in the text (there's also a call tosize
before the next guaranteed output). As you seem to run into an infinite or near-infinite loop, you might have a) implemented a hash-map and did not separate the linked lists well, or put everything in a single hash-map entry, or b) have created a pointer loop, maybe by usingfree
on a node that's still in use. I'd tryvalgrind
on input that does finish first.