diff options
Diffstat (limited to 'wk5/pset/speller')
-rw-r--r-- | wk5/pset/speller/dictionary.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/wk5/pset/speller/dictionary.c b/wk5/pset/speller/dictionary.c index 87a77a4..c095ad4 100644 --- a/wk5/pset/speller/dictionary.c +++ b/wk5/pset/speller/dictionary.c @@ -48,13 +48,8 @@ bool check(const char *word) // Hashes word to a number unsigned int hash(const char *word) { - // (sum of (letter - 'A') % 26) of a word to get a value of where to store it in the hash table - int val = 0; - for (int i = 0; word[i] != '\0'; i++) - { - val += toupper(word[i]) - 'A'; - } - return (val % 26); + // TODO: Improve this hash function + return toupper(word[0]) - 'A'; } // Loads dictionary into memory, returning true if successful, else false |