ProgrammingModerate

A recursive merge sort on 10^6 elements makes how many comparisons, roughly?

  1. A. About 10^6, which is n
  2. B. About 10^12, which is n^2
  3. C. About 2 x 10^7, which is n log2 n
  4. D. About 10^9, which is n^1.5

Correct answer: C. About 2 x 10^7, which is n log2 n

Merge sort does about n log2 n comparisons, and log2(10^6) is about 20, so about 2 x 10^7.

More C Programming questions

Exams that ask this topic