Questions tagged [pset5-hashfunction]

The tag has no usage guidance.

5 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
1 vote
2 answers
7k views

PSET5 Speller hash function

I have been working on the speller problem in pset5 for a while now, and I am not able to figure out the problem in my hash function: unsigned int hash(const char* word) { int M = 1000000001; ...
user avatar
0 votes
1 answer
39 views

Speller perfomance question

I've completed speller and passed all checks. But I'm still bugged about the performance. I did my best with research and running tests, but my implementation is slower by 10-20% compared to staff's ...
user avatar
  • 1
0 votes
1 answer
35 views

I just can't figure out how to put the word into lowercase for the hash function to provide the same index

bool check(const char *word) { char mot2[46]; for (int o = 0, h = strlen(word); o < h + 1; o++) { mot2[o] = tolower(word[o]); } int y = hash(word); node *cursor = table[y]; while (cursor != ...
user avatar
0 votes
0 answers
127 views

PSET 5 SPELLER - HELP!

i'm not sure why this happens when I execute the code. The program seems to never end as if it's running an infinite loop. When I run valgrind on it misspelled words keep spewing out and it gives me a ...
user avatar
  • 5
0 votes
1 answer
92 views

PSET5 : My program outputs wrong number of misspelled words

#define MAXH 145709 int total_words = 0; typedef struct node { char word[LENGTH + 1]; struct node* next; }node; node *hashtable[MAXH]; // djb2 by Dan Bernstein unsigned long hash(unsigned ...
user avatar