ProgrammingHard

Keys 6, 1 and 11 are inserted with linear probing into a table of size 5, h(k) = k % 5. In which order do the keys appear when the table is scanned from slot 0 upwards?

  1. A. 1, 6, 11
  2. B. 6, 11, 1
  3. C. 6, 1, 11
  4. D. 11, 1, 6

Correct answer: C. 6, 1, 11

6 takes slot 1, 1 probes to slot 2 and 11 probes to slot 3. The scan order is the slot order, not the insertion order.

More C Programming questions

Exams that ask this topic