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

Two sorted lists [3, 5, 12, 13, 20, 31] and [3, 8, 10, 26, 27, 34, 39] are merged using the standard merge step. How many element comparisons are made?

  1. A. 10
  2. B. 9
  3. C. 6
  4. D. 11

Correct answer: D. 11

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

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

Exams that ask this topic