Question discussion

A hash table of size 7 uses h(k) = k mod 7 with linear probing. The keys 15, 22, 8, 29, 36 are inserted in this order. At which index is 36…

971Medium DSSSB TGT Computer Science 0 replies

A hash table of size 7 uses h(k) = k mod 7 with linear probing. The keys 15, 22, 8, 29, 36 are inserted in this order. At which index is 36 stored?

  • A5
  • B3
  • C1
  • D4
Correct answer: A

Explanation

All the keys hash to index 1, so they occupy indices 1, 2, 3, 4 and then 5 in the order of insertion; 36 lands at index 5.

Discussion 0

Nobody has replied yet. Start the discussion!