I am having issues with this problem set. I have already implemented the load and size function. I am having issues with the check() function.
This is the output I get when I run ./speller texts/austinpowers.txt vs the output of cs50's staff
left is my output, right is theirs
WORDS MISSPELLED: 17822 vs 644 (check not working)
WORDS IN DICTIONARY: 143091 vs 143091 (load seems to work)
WORDS IN TEXT: 19190 vs 19190
TIME IN load: 0.04 vs 0.04
TIME IN check: 0.01 vs 0.02
TIME IN size: 0.00 vs 0.00
TIME IN unload: 0.00 vs 0.01
TIME IN TOTAL: 0.05 vs 0.07 * I haven't coded the unload() yet, that's the reason mine seems faster, and also the check function isn't working which is maybe skipping a lot of operations.
I know there are a lot of wrong things about my code related to design and memory which I'll fix after it is functioning correctly with some design tweaking and valgrind
this is my check function: https://gist.github.com/anonymous/a638f4a10bd5f1e50f3d
this is the all the code: https://gist.github.com/anonymous/5f7ec3c7d551d56b3afb
I have a few thougts, my issue could be:
the '\0' character, the '\n' character (maybe in the load() which as a side effects breaks my check()?. I've been trying to overwrite '\n' with '\0' in index strlen(word) but to no avail the output of my program remains the same
*note that I am using the format %s\n in scanf in load()
It could also be the node* cursor; because cursor -> doesn't really exist, but I am using it because cursor points to the head called hashtable[hash(word)] and therefore if cursor points there cursor -> next will point to the head which points to the first element which does have a ->next if not NULL
thanks