Data Structures & AlgorithmsHardGATE CS · TCS NQT · Product Company SDE

Standard top-down merge sort is run on [3, 48, 14, 99, 61, 71, 8, 15]. How many element comparisons happen during all the merge steps combined?

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

Correct answer: A. 16

Recursively split in half, then merge: each merge step compares the fronts of the two halves until one is exhausted. Total comparisons across all merges: 16.

More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions

Exams that ask this topic