ProgrammingModerate

Keys are stored with h(k) = k % 10 in a chained table. Which key set gives the longest single chain for five keys?

  1. A. 1, 2, 3, 4, 5
  2. B. 10, 11, 12, 13, 14
  3. C. 5, 15, 25, 35, 45
  4. D. 10, 20, 30, 40, 50

Correct answer: D. 10, 20, 30, 40, 50

All keys in 10, 20, 30, 40, 50 share remainder 0, so they all sit in one chain of length 5. The other sets spread across buckets.

More C Programming questions

Exams that ask this topic