Answered step by step
Verified Expert Solution
Link Copied!

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

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)
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Big Data Systems A 360-degree Approach

Authors: Jawwad ShamsiMuhammad Khojaye

1st Edition

0429531575, 9780429531576

More Books

Students also viewed these Databases questions

Question

Question Who can establish a Keogh retirement plan?

Answered: 1 week ago