ProgrammingVery hard

The number of comparisons a merge of two sorted arrays of sizes 4 and 6 makes in the worst case is at most?

  1. A. 10
  2. B. 8
  3. C. 5
  4. D. 9

Correct answer: D. 9

Each comparison outputs one element, and the last element needs no comparison, so at most 4 + 6 - 1 = 9.

More C Programming questions

Exams that ask this topic