Direction: Consider a binary max-heap implemented using an array :
-
The keys 12, 18, 13, 2, 3, 23, 5 and 15 are inserted into an initially empty hash table of length 10 using open addressing with hash function h(k) = k mod 10 and linear probing. What is the resultant hash table?
Correct Option: C
12 mod 10 = 2
18 mod 10 = 8
13 mod 10 = 3
2 mod 10 = 2 collision
(2 + 1) mod 10 = 3 again collision
(using linear probing)
(3 + 1) mod 10 = 4
3 mod 10 = 3 collision
(3 + 1) mod 10 = 4 again collision
(using linear probing)
(4 + 1) mod 10 = 5
23 mod 10 = 3 collision
(3 + 1) mod 10 = 4 collision
(4 + 1) mod 10 = 5 again collision
(using linear probing)
(5 + 1) mod 10 = 6
5 mod 10 = 5 collision
(5 + 1) mod 10 = 6 again collision
(6 + 1) mod 10 = 7
15 mod 10 = 5 collision
(5 + 1) mod 10 = 6 collision
(6 + 1) mod 10 = 7 collision
(7 + 1) mod 10 = 8 collision
(8 + 1) mod 10 = 9 collision
So, resulting hash table