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

X1232: 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:
hashAverage("Grace",10)5
hashAverage("Emma",10)7
hashAverage("Julia",10)9
Your Answer:
C. public int hashAverage(String value, int size)
 X1232: Hash Average Char Position Write a function that computes a

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!