I need to write a string hash function that puts 3-10 words into each bucket. There are all the words in the English dictionary. Any guidance on where to go for a good research site, or some inside knowledge from this great community would be greatly helpful.
Thanks,
Lemi
Question about string hash funtions
Page 1 of 14 Replies - 279 Views - Last Post: 11 September 2011 - 03:53 PM
Replies To: Question about string hash funtions
#3
Re: Question about string hash funtions
Posted 11 September 2011 - 03:36 PM
JackOfAllTrades, on 11 September 2011 - 12:43 PM, said:
Gee, if only there were a SEARCH function on this forum, you might've found this!
Well i mean like i have not searched this forum for one. The problem is i don't really know how to write my own for strings. I currently have one that looks like this
int hash(const string& str)
{
// loops throught the length of the string
unsigned int h=0;
for (int i = 0; i < str.length() + 1; ++i)
h= h * i + str[i];
return h % 33;
}
The only thing is i don't really know what the h = h * i + str[i]; is doing and why its doing it like that.
#4
Re: Question about string hash funtions
Posted 11 September 2011 - 03:40 PM
#5
Re: Question about string hash funtions
Posted 11 September 2011 - 03:53 PM
you might look at the Pearson Hash also.
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote








|