Wrote a Hash program that hashed based off the first letter and my TA (teaching assistant) gave me credit for the lab but told me that 26 base hash was not very good. I am speculating that it would be better to hash on fewer letters (maybe like a telephone hash shifting 2 places to the left). But I never followed up with the TA so I'm not sure where he was coming from. It might a performance issue. Would love to get the take of others.Originally posted here by Ghostdog
Hash table are often used with list to speed up search. The hash function depends on the data you work with. For example you work with words. The hash function can return a number between 0 to 25 according to the first character of the word. So you have the hash table (an array of 26) and after 26 list for the words. The hash function can also be the sum of the ascii characters of the worlds.
You can find an example with C source Here
or an other one Here.
Cheers,
-D




Reply With Quote