The GATE Grind

GATE 2025 CS (CS1) – Question 65

Programming and Data Structures · Hashing · 2 marks · Numerical answer

In a double hashing scheme, $h_1(k) = k \bmod 11$ and $h_2(k) = 1 + (k \bmod 7)$ are the auxiliary hash functions. The size $m$ of the hash table is 11. The hash function for the $i$-th probe in the open address table is $[h_1(k) + i\,h_2(k)] \bmod m$. The following keys are inserted in the given order: 63, 50, 25, 79, 67, 24.

The slot at which key 24 gets stored is ___________. (Answer in integer)

Practise this question in The GATE Grind →

Show answer and explanation

Correct answer: 10

Explanation

63→8, 50→6, 25→3, 79→2 and 67→1, all with no collision. For 24, h1=2 is occupied and h2=1+3=4. Probe i=1 gives 6 (occupied) and i=2 gives (2+8) mod 11 = 10 (free), so 24 goes to slot 10.