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

Two sorted lists [19, 23, 28, 35] and [5, 12, 22, 29, 32, 35] are merged using the standard merge step. How many element comparisons are made?

  1. A. 4
  2. B. 5
  3. C. 7
  4. D. 9

Correct answer: D. 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