summaryrefslogtreecommitdiff
path: root/wk5/pset
diff options
context:
space:
mode:
authorFudgerboy <91767657+Fudgerboy@users.noreply.github.com>2024-04-29 03:26:22 +0000
committerFudgerboy <91767657+Fudgerboy@users.noreply.github.com>2024-04-29 03:26:22 +0000
commit4c2b530a1f4136139119198eb76a283006da1c99 (patch)
tree43e6d0dec61a16be1bcc38a7dc53838213483b93 /wk5/pset
parent90010d2121facc5b8e4c0b6ceebf42f6fbc8fa60 (diff)
Sun, Apr 28, 2024, 8:26 PM -07:00
Diffstat (limited to 'wk5/pset')
-rw-r--r--wk5/pset/speller/dictionary.c9
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