GATE Computer ScienceHardGATE CSE · NIELIT

Top-down merge sort (standard two-way merge, one comparison per element moved while both lists are non-empty) sorts [38, 27, 43, 3, 9, 82, 10, 15]. How many key comparisons are performed?

  1. A. 17
  2. B. 15
  3. C. 19
  4. D. 18

Correct answer: A. 17

Merging the pairs, the quadruples and the final two halves costs 17 comparisons in all.

More Algorithms questions

Exams that ask this topic