Data Structures & AlgorithmsVery hardProduct placement · Amazon/Microsoft

Keys 121, 29, 37, 91, 13, 33, 39 are inserted in this order into an empty table of size 13 by double hashing: h1(k) = k mod 13, h2(k) = 7 − (k mod 7), probe i at (h1(k) + i·h2(k)) mod 13. In which slot is 39 placed?

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

Correct answer: B. 6

h1(39) = 0 and h2(39) = 3; stepping by 3 from the home slot, the first free slot is 6 after 3 probe(s).

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

Exams that ask this topic