Skip to main content
10 events
when toggle format what by license comment
Apr 11, 2019 at 6:50 comment added John Doe I think I finally got it. I was trying to compare hashtable[k]->word and cur->word when I should have compared cur->word and word. But I still have one small problem the check function seems to ignore the last word in the text. So if the text contain say 3 words it would only check the first two not sure why?
Apr 11, 2019 at 6:19 comment added John Doe I think I didn't explain myself clearly. Correct me if I'm wrong but I believe both hashtable[k]->word and cur->word are words that belong to the dictionary. If that is true comparing them will always result in the word being correctly spelled. Right? Am I missing something here? I did review all previous lectures and shorts but I can't figure it out. I'm really struggling with this one.
Apr 11, 2019 at 4:34 comment added Cliff B On the first pass through the loop, cur points to the same node as hashtable[n]. At the end of the loop, the line cur = cur->next; sets the pointer cur to point to the next node in the linked list, so no, it isn't pointing at the same node each time. If you still don't understand, you need to go back and review all of the material on linked lists and structures.
Apr 10, 2019 at 14:54 comment added John Doe Yes, but cur->word always points to a node or a word that belongs to the dictionary, right ?. Which means that by comparing cur->word and hashtable->word we are comparing two word from the same source (dictionary). Don't we want to compare it to a word from txt file instead ? I'm sorry if I'm asking too many questions but I'm really lost :)
Apr 10, 2019 at 0:40 comment added Cliff B cur->word is only the same as hashtable->word on the first pass through the loop. cur = cur->next; changes cur to point at the next node in the linked list.
Apr 9, 2019 at 22:36 comment added John Doe I think that using cur->word is just checking the same word since both cur->word and hashtable->word are pointing to the same thing. I'm not sure what to so here.
Apr 9, 2019 at 20:45 comment added John Doe I have tried using cur->word instead but it just makes all words correct even when they are not on the dictionary.
Apr 9, 2019 at 10:12 comment added Cliff B it's NOT checking cur->word, it's checking hashtable[k]->word each time.
Apr 9, 2019 at 10:02 comment added John Doe Sorry I'm not sure how to fix it can you be more explicit please ?
Apr 9, 2019 at 7:55 history answered Cliff B CC BY-SA 4.0