Data Structures & AlgorithmsModerateInfosys · Hashing

Keys 12, 22, 32, 13, 23 are inserted in this order into an empty hash table of size 10 using h(k) = k mod 10 and linear probing. At which index is 23 stored?

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

Correct answer: B. 6

12 -> 2, 22 -> 3, 32 -> 4, 13 -> 3 taken, 4 taken, so 5; 23 probes 3, 4, 5 (all taken) and lands at 6.

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

Exams that ask this topic