Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

ISRO | ISRO CS 2016 | Question 26

  • Last Updated : 23 Mar, 2018

A Hash Function f is defined as f(key) = key mod 7. With linear probing, while inserting the keys 37, 38, 72, 48, 98, 11, 56 into a table indexed from 0, in which location the key 11 will be stored (Count table index 0 as 0thlocation)?
(A) 3
(B) 4
(C) 5
(D) 6


Answer: (C)

Explanation: Hash function = f(key) = key mod 7
insertion order= 37, 38, 72, 48, 98, 11, 56
Insert 37: 37 mod 7 = 2
Insert 38: 38 mod 7 = 3
Insert 72: 72 mod 7 = 2, but already occupied, so after linear probing it would occupy index 4.
Insert 48: 48 mod 7 = 6
Insert 98: 98 mod 7 = 0
Insert 11: 11 mod 7 = 4, but already occupied, after linear probing it would get into index 5.
So, option (C) is correct.

Quiz of this Question
Please comment below if you find anything wrong in the above post

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!