I need help writing a hash function. I don’t really understand them too much but I need to make one for a list of words. I’m writing a program that finds every word in a Word Search that appears in the Word Search’s “dictionary”. For example if the category of the puzzle was “food” then some words in the dictionary may be: apple, carrot, orange, ect. I need to do this by both double hashing and linear probing which I think I understand but I don’t know how to make a good hash function to do so. Can anyone help>
Share
As far as I understand, you need to build a hash function for a set of words, right? Simple sequential XORing (+ rotating, if the word order matters) of hashCode()’s for each word will do a good job for you.
If unsure, create a class for which you need to build a hash function and execute the
Source - Generate hashCode() and equals()command in Eclipse for this class.