Question: X 1 2 2 9 : Hash Function Sum Digits Write a function in Java called hashSumDigits ( ) that will take a non -

X1229: Hash Function Sum Digits
Write a function in Java called hashSumDigits() that will take a non-negative value to be stored in a hash table and the size of the table and returns the index where the value will be stored.
This hash function sums all the digits in the value to be stored and then returns the modulo of that sum with the size of the table.
You should use a loop to sum of all the digits. Remember that mod(%) by 10 yields the rightmost digit (e.g.,126%10 is 6), while division () by 10 removes the rightmost digit (e.g.,12610 is 12).
Examples:
hashSumDigits (126,5)4
hashSumDigits (49,5)3
hashSumDigits (731,5)1
 X1229: Hash Function Sum Digits Write a function in Java called

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!