1
You visited us 1 times! Enjoying our articles? Unlock Full Access!
Question

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?

A
 0 1 2 12 3 13 4 5 5 6 7 8 18 9
No worries! Weâ€˜ve got your back. Try BYJUâ€˜S free classes today!
B
 0 1 2 12 3 13 4 2 5 3 6 23 7 5 7 18 9 15
Right on! Give the BNAT exam to get a 100% scholarship for BYJUS courses
C
 0 1 2 12,2 3 13,3,23 4 5 5,15 6 7 8 18 9
No worries! Weâ€˜ve got your back. Try BYJUâ€˜S free classes today!
D
 0 1 2 2 3 23 4 5 15 6 7 8 18 9
No worries! Weâ€˜ve got your back. Try BYJUâ€˜S free classes today!
Open in App
Solution

The correct option is B 0 1 2 12 3 13 4 2 5 3 6 23 7 5 7 18 9 15 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 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 (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 So, resulting hash table 0 1 2 12 3 13 4 2 5 3 6 23 7 5 8 18 9 15

Suggest Corrections
13
Join BYJU'S Learning Program
Related Videos
Dot Product
MATHEMATICS
Watch in App
Join BYJU'S Learning Program