ProgrammingHard

A hash table of size 5 uses h(k) = k mod 5 with linear probing. The keys 5, 10, 15 and 3 are inserted in that order into an empty table. How many of these insertions needed at least one extra probe?

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

Correct answer: B. 2

10 and 15 both hash to slot 0 and must probe further. 5 and 3 land in their home slots.

More C Programming questions

Exams that ask this topic