Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I am learning hashing and I understand how the probing will work but I cannot fo

ID: 3573632 • Letter: I

Question

I am learning hashing and I understand how the probing will work but I cannot follow the full sequence. If you can help me write the java function, I will be able to write the C function just fine. Please explain part A! Thank you.

The keys 34, 25, 79, 56, 6 are to be inserted into a hash table of length 11, where collisions will be resolved by open addressing. The hash function is h0k,i) (k mod 11 i (1 k mod10)) mod 11 a. Calculate the probe sequence of each of the above keys. b. Write a program in Java that calculates and prints out the probe sequences you computed in (a) Write a program in C that does the same thing

Explanation / Answer

Hash table:

0:

1:

2:

3:

4:

5:

6:

7:

8:

9:

10:

To find the values of hashes you need to put numbers into a table using the hash equation. Incase of collision increment the i by 1. Everytime start with i as 0.

Start by inserting 34. h(34,0) = (34mod11 + 0*(1+34mod10))mod11 = 1

Then for 25. h(25,0) = (25mod11 + 0*(1+25mod10))mod11 = 3

Then for 79. h(79,0) = (79mod11 + 0*(1+56mod10))mod11 = 2

Then for 56. h(56,0) = (56mod11 + 0*(1+56mod10))mod11 = 1 which is a collision. Hence, increment i to 1

Then for 56. h(56,1) = (56mod11 + 1*(1+56mod10))mod11 = 8

Then for 6. h(6,0) = (6mod11 + 0*(1+6mod10))mod11 = 6

Hence, the probe sequence: 1,3,2,8,6

Therefore, hash table

0:

1: 34

2: 79

3: 25

4:

5:

6: 6

7:

8: 56

9:

10: