Data Structures & AlgorithmsHardProduct placement · Amazon/Microsoft

Keys 13, 14, 24, 27, 70, 76, 91, 15 are inserted in this order into an empty hash table of size 13 with h(k) = k mod 13 and linear probing. In which slot does 15 end up?

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

Correct answer: C. 4

15 hashes to 2, which is occupied; linear probing tries the following slots one by one and finds the first free one at 4 after 3 probes.

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

Exams that ask this topic