2
votes
Accepted
STILL baffling check50 fail for speller.c!
On some versions of C, you cannot declare a global variable index if you include <string.h>. Apparently the check50 server has such a version (and the IDE does not). There is a comment about it ...
1
vote
Accepted
PSET5: Missing Words from Text and Memory Leaks
I'm surprised it didn't seg fault. The hash function generates results > N. That means that it's creating entries in the table[] array beyond it's range.
When unload runs, it's not finding the ...
1
vote
Accepted
Speller - not sure what's wrong
I believe the problem might be here:
for (int i = 0; i < N; i++)
{
//temp points to what table points to
temp = table[i];
//cursor points to what table points to
cursor = table[i];
...
1
vote
PSET 5 Spell Checker - Error: Could not load dictionaries/large
Ugh! I figured it out. I was returning "false" from the load function. Can't believe I missed that!
Resolved.
1
vote
Pset5 dictionary.c load and check: returning all words as misspelled?
The unload function is intended to do all the freeing.
When this line free(ptr); executes in the load function it is freeing the root node. Why? last line feed of last word does this ptr = root;. ...
1
vote
Accepted
PSET5 All words misspelled (trie structure)
I see a couple of problems in the load function.
For each new word in the dictionary, don't you want to start crawling the trie at the root node?
When you create a new node here next->children[...
1
vote
Accepted
PSET 5: Dictionary.c, Trie structure, Check/Load, All words misspelled
You're on the right track - there is something wrong in load(). It's a subtle logic problem. When you process each character, the following line is processed:
strider = strider->children[...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
misspelling × 27pset5 × 24
speller × 13
check50 × 5
load × 5
dictionary × 5
cs50x × 2
segmentation-fault × 2
trie × 2
valgrind × 1
check × 1
hash-table × 1
segfault × 1
free × 1
speller-check × 1
pset5-hashfunction × 1
capitalize × 1