Data Structures & AlgorithmsHardProduct placement · Amazon/Microsoft

Keys 28, 19, 53, 91, 92, 20, 74, 89 are inserted in this order into an empty hash table of size 10 with h(k) = k mod 10 and linear probing. In which slot does 89 end up?

  1. A. 6
  2. B. 7
  3. C. 5
  4. D. 9

Correct answer: C. 5

89 hashes to 9, which is occupied; linear probing tries the following slots one by one and finds the first free one at 5 after 7 probes.

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

Exams that ask this topic