Data Structures & AlgorithmsHardGATE CS · Product placement

Keys 47, 74, 63, 43, 45, 59, 85 are inserted in this order into an empty table of size 13 using quadratic probing: probe i goes to (k mod 13 + i²) mod 13 for i = 0, 1, 2, …. In which slot is 85 placed?

  1. A. 10
  2. B. 7
  3. C. 4
  4. D. 3

Correct answer: D. 3

85 hashes to 7. Offsets 0, 1, 4, 9, … are added to the home slot; the first free slot is 3 (probe i = 3). Linear probing would have placed it in slot 10.

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

Exams that ask this topic