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

Keys 88, 69, 39, 31, 97 are inserted into a hash table of size 8 with h(k) = k mod 8 and linear probing. At which index is 97 stored?

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

Correct answer: B. 2

Insert in order, moving to the next slot on collision. Final table: [88, 31, 97, –, –, 69, –, 39]; 97 is at index 2 (home slot 1 was taken).

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

Exams that ask this topic