Consider a hash table of size 7, with hash function H (k) = k % 7, and pseudo random i = (i + 5) % 7. We want to insert the following keys one by one from left to right. 15, 11, 25, 16, 9, 8, 12 What will be the position of the key 25, if we use random probing?
Consider a hash table of size 7, with hash function H (k) = k % 7, and pseudo random i = (i + 5) % 7. We want to insert the following keys one by one from left to right. 15, 11, 25, 16, 9, 8, 12 What will be the position of the key 25, if we use random probing? Correct Answer 2
Since we are using random probing:
Insert 15:
(15)%7 = 1
Insert 11:
(11)%7 = 4
Insert 25:
(25)%7 = 4 // collision:
i = 4
i = (i + 5) % 7 // using random function
i = (4 + 5)%7 = 2
Hence 25 position is 2nd
মোঃ আরিফুল ইসলাম
Feb 20, 2025