GATE Computer ScienceVery hardGATE CS (PYQ pattern)

A hash table of size 11 uses linear probing with h(k) = k mod 11. Keys 43, 22, 33, 54, 65, 76, 87, 14, 25 are inserted in this order (no deletions). How many extra probes (beyond the first slot tried) are used in total, and in which slot does key 25 land?

  1. A. 23 extra probes, slot 7
  2. B. 26 extra probes, slot 7
  3. C. 26 extra probes, slot 5
  4. D. 30 extra probes, slot 8

Correct answer: B. 26 extra probes, slot 7

43, 54, 65, 76, 87 hash to slot 10 and 22, 33 hash to slot 0, so they pile into slots 10 and 0 to 5 in one wrapped cluster; 14 and 25 (hash 3) must then skip to slots 6 and 7. The extra probes add up to 26.

More Programming and Data Structures (GATE) questions

Exams that ask this topic