Skip to content
GATEiit

GATE DA 2025 Q18: Hashing with linear probing: h(x) = 3x mod 10

Question

Consider a hash table of size 10 with indices {0,1,…,9}\{0, 1, \ldots, 9\}, with the hash function

h(x)=3x(mod10),h(x) = 3x \pmod{10},

where linear probing is used to handle collisions. The hash table is initially empty and then the following sequence of keys is inserted into the hash table: 1,4,5,6,14,151, 4, 5, 6, 14, 15. The indices where the keys 14 and 15 are stored are, respectively

Try it: multiple choice: exactly one correct option

Select one option
Wrong answer costs 1/3 mark in GATE.
Show answer and explanation

Answer: D (official GATE 2025 final answer key)

Concept used: Hash table insertion with linear probing.

First step: Place the first four keys: h(1)=3h(1) = 3, h(4)=2h(4) = 2, h(5)=5h(5) = 5, h(6)=8h(6) = 8. Then h(14)=2h(14) = 2 is already taken, so probe forward.

Full step-by-step solution

Detailed working, common mistakes and linked mock tests will be available with a free GATEiit account. Log-in is coming soon.

Share this question

WhatsAppDownload image

Source: official GATE 2025 DA question paper and final answer key, organised by IIT Roorkee. Question paper · Answer key