GATE DA 2025, Q.18: Where 14 and 15 land in a hash table
The question
A hash table of size 10 uses h(x) = 3x mod 10 with linear probing. Keys 1, 4, 5, 6, 14, 15 are inserted in that order. At which indices are 14 and 15 stored?
- (A) 2 and 5
- (B) 2 and 6
- (C) 4 and 5
- (D) 4 and 6
Watch it solved
Solve it step by step
- First four. 1 → 3, 4 → 2, 5 → 5, 6 → 8.
- 14. h = 42 mod 10 = 2: taken; 3: taken; 4: free. 14 goes to 4.
- 15. h = 45 mod 10 = 5: taken; 6: free. 15 goes to 6.
Answer: (D) 4 and 6
Official IIT Roorkee answer key: D.
Common mistake. Stopping at the hash value without probing (giving 2 and 5).
Remember. Linear probing: try h, h + 1, h + 2, … until a free slot.
Want every question solved? The past-paper pack has all 195 questions from 2024, 2025 and 2026 for ₹499. The cheat sheet pack has 23 printable sheets for ₹399.
See the past-paper pack See the cheat sheetsSource: official GATE DA 2025 question paper and answer key (IIT Roorkee). The question is lightly reworded; every number and option is kept.