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

Keys 17, 18, 96, 39, 87, 29 are inserted into a hash table of size 10 with h(k) = k mod 10 and linear probing. At which index is 29 stored?

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

Correct answer: B. 1

Insert in order, moving to the next slot on collision. Final table: [87, 29, –, –, –, –, 96, 17, 18, 39]; 29 is at index 1 (home slot 9 was taken).

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

Exams that ask this topic