Data Structures & AlgorithmsHardGATE CSE · Hashing

Keys 10, 21, 32, 43, 54 are inserted in this order into an empty table of size 11 using h(k) = k mod 11 and quadratic probing, the i-th probe being (h(k) + i^2) mod 11. At which index does 54 end up?

  1. A. 4
  2. B. 2
  3. C. 8
  4. D. 9

Correct answer: A. 4

All keys hash to 10. 21 goes to 0, 32 to 3 (probe 2), 43 to 8 (probe 3), and 54 tries 10, 0, 3, 8 (taken) before probe 4 gives (10 + 16) mod 11 = 4.

More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions

Exams that ask this topic