summaryrefslogtreecommitdiff
path: root/wk5/pset
diff options
context:
space:
mode:
authorFudgerboy <91767657+Fudgerboy@users.noreply.github.com>2024-04-29 02:33:05 +0000
committerFudgerboy <91767657+Fudgerboy@users.noreply.github.com>2024-04-29 02:33:05 +0000
commitd01a592bc5f4197986e5f7920d466f2f77dcdfd9 (patch)
treedb5417674658b2d6761327dc945792ba12302f74 /wk5/pset
parentf3659316c9e8d245227c83274b4514a45ba9e228 (diff)
Sun, Apr 28, 2024, 7:33 PM -07:00
Diffstat (limited to 'wk5/pset')
-rw-r--r--wk5/pset/speller/dictionary.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/wk5/pset/speller/dictionary.c b/wk5/pset/speller/dictionary.c
index e993353..bc4029a 100644
--- a/wk5/pset/speller/dictionary.c
+++ b/wk5/pset/speller/dictionary.c
@@ -98,13 +98,17 @@ bool load(const char *dictionary)
// set the new ptr
ptr->next = NULL;
// hash the word to find the bucket it goes in
- int val = hash(word);
+ int val = hash(ptr->word);
// put new node at begining of bucket
if (table[val]->next != NULL)
{
ptr->next = table[val]->next;
+ table[val]->next = ptr;
+ }
+ else
+ {
+ table[val]->next = ptr;
}
- table[val]->next = ptr;
}
// Close the dictionary file