diff options
author | Fudgerboy <91767657+Fudgerboy@users.noreply.github.com> | 2024-04-29 03:29:03 +0000 |
---|---|---|
committer | Fudgerboy <91767657+Fudgerboy@users.noreply.github.com> | 2024-04-29 03:29:03 +0000 |
commit | 854530dbb95941f2aa380b1cb3631b5ac3e87fda (patch) | |
tree | d8100f4d49acbc483015081c387d13a66310e982 /wk5/pset | |
parent | 4c2b530a1f4136139119198eb76a283006da1c99 (diff) |
Sun, Apr 28, 2024, 8:29 PM -07:00
Diffstat (limited to 'wk5/pset')
-rw-r--r-- | wk5/pset/speller/dictionary.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/wk5/pset/speller/dictionary.c b/wk5/pset/speller/dictionary.c index c095ad4..82f605a 100644 --- a/wk5/pset/speller/dictionary.c +++ b/wk5/pset/speller/dictionary.c @@ -44,12 +44,11 @@ bool check(const char *word) return false; } - // Hashes word to a number unsigned int hash(const char *word) { - // TODO: Improve this hash function - return toupper(word[0]) - 'A'; + // (sum of (letter - 'A') % 26) of a word to get a value of where to store it in the hash table + return word[0] % 26; } // Loads dictionary into memory, returning true if successful, else false @@ -115,8 +114,7 @@ bool load(const char *dictionary) // Returns number of words in dictionary if loaded, else 0 if not yet loaded unsigned int size(void) { - // TODO - return 0; + return siz; } // Unloads dictionary from memory, returning true if successful, else false |