Data Structures & AlgorithmsHardGATE CS · TCS NQT · Product Company SDE

Keys 81, 58, 72, 25, 31 are inserted into a hash table of size 10 with h(k) = k mod 10 and linear probing. At which index is 58 stored?

  1. A. 8
  2. B. 12
  3. C. 6
  4. D. 9

Correct answer: A. 8

Insert in order, moving to the next slot on collision. Final table: [–, 81, 72, 31, –, 25, –, –, 58, –]; 58 is at index 8.

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

Exams that ask this topic