ProgrammingVery hard

A table of size 7 uses h(k) = k % 7 with linear probing. Keys 14, 21, 7 and 0 are inserted in that order. In which slot does key 0 land?

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

Correct answer: A. 3

14 takes slot 0, 21 probes to slot 1, 7 probes to slot 2 and 0 probes through slots 0, 1 and 2 to reach slot 3.

More C Programming questions

Exams that ask this topic