GATE / CS ARCHIVE

GATE CSE 2026 SET 1 / QUESTION 24

Linear probing with wraparound

Data Structures · Hashing · Full GATE CSE 2026 Set 1 paper

GATE 2026 Set 1, Q24 1 mark · MSQ
Report issue

Hashing

Question 24, GATE 2026: An initially empty table has indices 0–10, hash h(x)=(x+7) mod 11, and linear probing. Insert 1,13,22,15,11,24 in that order. Which listed positions are empty: A 0, B 10, C 2, D 1?
Tap to enlarge
Select all that apply
Answer & solution

Official answer: C

Step through it (8 steps)

Givens and goal

An initially empty table has indices 0–10, hash h(x)=(x+7) mod 11, and linear probing. Insert 1,13,22,15,11,24 in that order. Which listed positions are empty: A 0, B 10, C 2, D 1?

Approach

Trace each home slot and each collision in insertion order, wrapping from index 10 to 0.

Step-by-step solution

1. Insert 1: h(1)=8, so place 1 at slot 8. Insert 13: h(13)=20 mod 11=9, so place 13 at 9.
2. Insert 22: h(22)=29 mod 11=7, so place 22 at 7. Insert 15: h(15)=22 mod 11=0, so place 15 at 0.
3. Insert 11: h(11)=18 mod 11=7. Slots 7,8,9 already contain 22,1,13. The first empty slot encountered is 10, so store 11 there.
4. Insert 24: h(24)=31 mod 11=9. Slots 9 and 10 are occupied; probing wraps to 0, which is also occupied. Slot 1 is empty, so place 24 at 1.
5. The final table is:

    index:  0   1   2  3  4  5  6   7   8   9   10
    value: 15  24   -  -  -  -  -  22   1  13   11

6. Of the four listed indices, only 2 is empty. Select C. The probing rule advances from the current candidate slot; it does not recompute a different hash after each collision.

Original paper, page 19 · Answer key