Question
ZOOM Page 7. Apply the following operations on the following Quadratic probing haslh table. Write down all your calculations and changes to the hash table Hashi (key): key % 16 Hash2(key): 11-key % 1…
ZOOM Page 7. Apply the following operations on the following Quadratic probing haslh table. Write down all your calculations and changes to the hash table Hashi (key): key % 16 Hash2(key): 11-key % 11 Double hashing probing sequence (Hashi (key) + i * Hash2(key)) % 16 149 3 88 a. (5 points)HashInsert(Table, 17) 6 16 7 23 8 24 10 42 12 99 13 14 15 b. (5 points)Hashremove(Table,16)
Solutions
Expert Solution
a) Insert table 17
Hash1(17)= 17%16 =1
Hash2(17) = 11- 17%11 =11- 6=5
When i=1
Location = (Hash1(17)+ i* Hash2(17))%16
= ( 1 + 1* 5) % 16
= (6)%16
= 6
Which is already occupied
When i=2
Location = (Hash1(17)+ i* Hash2(17))%16
= ( 1 + 2* 5) % 16
= (11)%16
= 11
Which is free
so 17 will be placed in location 11 as follows
b) To remove value 16
Hash1(16)= 16%16 =0
Hash2(16) = 11- 16%11 =11- 5=6
When i=1
Location = (Hash1(16)+ i* Hash2(16))%16
= ( 0 + 1* 6) % 16
= (6)%16
= 6
Location 6 has the value 16 . The delete the element 16 from
table. New hash table will be like