The GATE Grind

GATE 2025 CS (CS1) – Question 65

Algorithms · 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

Table size $m=11$; $h_1(k)=k\bmod11$, $h_2(k)=1+(k\bmod7)$; probe $i$: $(h_1+i\,h_2)\bmod11$.

Key$h_1$Slot
6388
5066
2533
7922
6711

Key 24: $h_1=24\bmod11=2$ (occupied by 79). $h_2=1+(24\bmod7)=1+3=4$.
- $i=1$: $(2+4)\bmod11=6$, occupied by 50.
- $i=2$: $(2+8)\bmod11=10$, empty.

Key 24 is stored in slot **10**.

More Hashing questions

All Hashing questions →