Data Structures & AlgorithmsHardTCS Digital · Infosys SP

Keys 107, 29, 82, 81, 18, 115, 85 are inserted in this order into an empty table of size 17 using quadratic probing: probe i goes to (k mod 17 + i²) mod 17 for i = 0, 1, 2, …. In which slot is 85 placed?

  1. A. 5
  2. B. 2
  3. C. 0
  4. D. 4

Correct answer: D. 4

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

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

Exams that ask this topic