GATE Computer ScienceVery hardGATE CS (PYQ pattern)

A table of size 13 uses double hashing, probe i of key k is (k mod 13 + i * (1 + k mod 11)) mod 13. Keys 18, 41, 22, 44, 59, 32, 31, 73 are inserted in order. How many collisions (failed probes) happen in total, and in which slot does key 73 end up?

  1. A. 5 collisions, slot 8
  2. B. 4 collisions, slot 9
  3. C. 4 collisions, slot 8
  4. D. 2 collisions, slot 8

Correct answer: C. 4 collisions, slot 8

Insert each key with its own step size. The probe counts per key are [0, 0, 0, 1, 0, 1, 2, 0], so 4 failed probes in all; the final table is [None, None, 41, None, 32, 18, 44, 59, 73, 22, None, None, 31].

More Programming and Data Structures (GATE) questions

Exams that ask this topic