ISRO Scientist/Engineer CSE 2014Algorithms › Hashing
ISRO Scientist/Engineer CSE 2014 PYQ: Consider a 13 element hash table for which f(key)=key mod 13 is used with integer keys. Assuming linear…
Consider a 13 element hash table for which f(key)=key mod 13 is used with integer keys. Assuming linear probing is used for collision resolution, at which location would the key 103 be inserted, if the keys 661, 182, 24 and 103 are inserted in that order?
- A0
- B1Correct answer
- C11
- D12
Answer
(B) 1
Approach
Compute each key's home slot as key mod 13, then insert in the given order using linear probing (scan forward cyclically to the next free slot). Track the table state after each insertion to find where 103 lands.
Reviewed by ISRO IQ Editorial Team.