Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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:
C public int hashAverageString value, int size
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started