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

Two sorted lists [6, 8, 12, 35] and [4, 11, 17, 20, 25, 29] are merged using the standard merge step. How many element comparisons are made?

  1. A. 4
  2. B. 14
  3. C. 9
  4. D. 10

Correct answer: C. 9

Compare heads until one list is exhausted; the leftover tail is copied without comparison. Comparisons = 9.

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

Exams that ask this topic