we'll see how to handle overflow when we talk about hashing strings in moment to summarizethe trick is to find hash function that' simple and fastyet excludes the non-data parts of the key and uses all the data use prime number for the modulo base often the hash function involves using the modulo operator (%with the table size we've already seen that it' important for the table size to be prime number when using quadratic probe or double hashing howeverif the keys themselves may not be randomly distributedit' important for the table size to be prime number no matter what hashing system is used this is becauseif many keys share divisor with the array sizethey may tend to hash to the same locationcausing clustering using prime table size eliminates this possibility for exampleif the table size is multiple of in our car part examplethe category codes will all hash to index numbers that are multiples of howeverwith prime number such as you are guaranteed that no keys will divide into the table size the moral is to examine your keys carefullyand tailor your hash algorithm to remove any irregularity in the distribution of the keys hashing strings we saw at the beginning of this how to convert short strings to key numbers by multiplying digit codes by powers of constant in particularwe saw that the four-letter word cats could turn into number by calculating key * * * * this approach has the desirable attribute of involving all the characters in the input string the calculated key value can then be hashed into an array index in the usual wayindex (keyarraysizehere' java method that finds the key value of wordpublic static int hashfunc (string keyint hashval int pow / * etc for(int =key length()- >= --/right to left int letter key charat( /get char code hashval +pow letter/times power of pow * /next power of return hashval arraysize/end hashfunc (the loop starts at the rightmost letter in the word if there are lettersthis is - the numerical equivalent of the letteraccording to the code we devised at the beginning of this ( = and so on)is placed in letter this is then multiplied by power of