diff options
author | Fudgerboy <91767657+Fudgerboy@users.noreply.github.com> | 2024-04-29 02:34:36 +0000 |
---|---|---|
committer | Fudgerboy <91767657+Fudgerboy@users.noreply.github.com> | 2024-04-29 02:34:36 +0000 |
commit | 43691e09454a41340f3ac3ae56dcff88f8fd7390 (patch) | |
tree | 0e5c4559dbab3483e7aba14616a4f09726f94482 /wk5/pset | |
parent | d01a592bc5f4197986e5f7920d466f2f77dcdfd9 (diff) |
Sun, Apr 28, 2024, 7:34 PM -07:00
Diffstat (limited to 'wk5/pset')
-rw-r--r-- | wk5/pset/speller/dictionary.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/wk5/pset/speller/dictionary.c b/wk5/pset/speller/dictionary.c index bc4029a..a0b9381 100644 --- a/wk5/pset/speller/dictionary.c +++ b/wk5/pset/speller/dictionary.c @@ -65,7 +65,7 @@ bool load(const char *dictionary) { // initialize the table for (int i = 0; i < N; i++) { - table[i]->next = NULL; + table[i] = NULL; // table[i]->word = ""; } @@ -100,14 +100,14 @@ bool load(const char *dictionary) // hash the word to find the bucket it goes in int val = hash(ptr->word); // put new node at begining of bucket - if (table[val]->next != NULL) + if (table[val] != NULL) { - ptr->next = table[val]->next; - table[val]->next = ptr; + ptr->next = table[val]; + table[val] = ptr; } else { - table[val]->next = ptr; + table[val] = ptr; } } |