hash tables 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 stringpublic 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 which is for the letter at - for the letter at - and so on the hashfunc (method is not as efficient as it might be aside from the character conversionthere are two multiplications and an addition inside the loop we can eliminate multiplication by taking advantage of mathematical identity called horner' method (horner was an english mathematician - this states that an expression like var * var * var * var * var * can be written as (((var * var )* var )* var )* var to evaluate this equationwe can start inside the innermost parentheses and work outward if we translate this to java methodwe have the following codepublic static int hashfunc (string keyint hashval key charat(