Question

Consider a hash table P[0,1,…,10]P[0, 1, \dots, 10] that is initially empty. The hash table is maintained using open addressing with linear probing. The hash function used is h(x)=(x+7) mod 11h(x) = (x + 7) \bmod 11.

Consider the following sequence of insertions performed on PP:

1,13,22,15,11,241, 13, 22, 15, 11, 24

Which of the following positions in the hash table is/are empty after these insertions are performed?

Choose every correct option
Official answer and solution
Official answer
C
From
Official GATE 2026 answer key

Solution

Insert each key sequentially using h(x)=(x+7) mod 11h(x) = (x + 7) \bmod 11 and linear probing (h(x)+i) mod 11(h(x) + i) \bmod 11.

Tracing each insertion into P[0..10]P[0..10]:

  1. x=1x = 1: h(1)=(1+7) mod 11=8  ⟹  P[8]=1h(1) = (1 + 7) \bmod 11 = 8 \implies P[8] = 1.
  2. x=13x = 13: h(13)=(13+7) mod 11=9  ⟹  P[9]=13h(13) = (13 + 7) \bmod 11 = 9 \implies P[9] = 13.
  3. x=22x = 22: h(22)=(22+7) mod 11=7  ⟹  P[7]=22h(22) = (22 + 7) \bmod 11 = 7 \implies P[7] = 22.
  4. x=15x = 15: h(15)=(15+7) mod 11=0  ⟹  P[0]=15h(15) = (15 + 7) \bmod 11 = 0 \implies P[0] = 15.
  5. x=11x = 11: h(11)=(11+7) mod 11=7h(11) = (11 + 7) \bmod 11 = 7 (occupied) →8\rightarrow 8 (occupied) →9\rightarrow 9 (occupied) →10\rightarrow 10 (empty)   ⟹  P[10]=11\implies P[10] = 11.
  6. x=24x = 24: h(24)=(24+7) mod 11=9h(24) = (24 + 7) \bmod 11 = 9 (occupied) →10\rightarrow 10 (occupied) →0\rightarrow 0 (occupied) →1\rightarrow 1 (empty)   ⟹  P[1]=24\implies P[1] = 24.

Occupied positions are {0,1,7,8,9,10}\{0, 1, 7, 8, 9, 10\}, and empty positions are {2,3,4,5,6}\{2, 3, 4, 5, 6\}. Among the given options, only position 2 is empty.

Final answer

Option (C)

The answer is the one in the official GATE answer key. The solution is this site's own explanation.

Source

Paper
GATE 2026 Computer Science and Information Technology - Session 1 (CS1)
Question
24 of 65
Section
Computer Science and Information Technology

Report an error in this question

GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.