GATE Computer ScienceVery hardGATE CS (PYQ pattern)

A table of size 11 uses quadratic probing h(k, i) = (k mod 11 + i^2) mod 11. Keys 23, 34, 45, 56, 67, 78, 89 (all congruent to 1 mod 11) are inserted in this order. What happens?

  1. A. All 7 keys are placed without failure
  2. B. Key 89 is placed in slot 4
  3. C. The table overflows only after the 11th key
  4. D. Key 89 cannot be placed although the table has empty slots

Correct answer: D. Key 89 cannot be placed although the table has empty slots

Probe offsets i^2 mod 11 take only the values 0, 1, 4, 9, 5, 3 (six distinct), so at most 6 keys with the same hash can be placed; key 89 fails with free slots still left.

More Programming and Data Structures (GATE) questions

Exams that ask this topic