Question: X 1 2 3 2 : Hash Average Char Position Write a function that computes a hask key for a string. The hash key is
X: Hash Average Char Position
Write a function that computes a hask key for a string. The hash key is the average of the position of each letter in the alphabet divided by the size of the table. You can use the charPosition defined in the previous exercise in your calculation, this correct implementation was provided for you in this exercises.
Thus, add up the position of each character in the string and then compute its average.
Then use this average and calculate the mod with the size of the table and return this value.
Examples:
hashAverageGrace
hashAverageEmma
hashAverageJulia
Your Answer:
public int hashAverageString value, int size
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
