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

Two sorted lists [6, 16, 24, 29] and [20, 22, 25, 35] are merged using the standard merge step. How many element comparisons are made?

  1. A. 8
  2. B. 11
  3. C. 5
  4. D. 7

Correct answer: D. 7

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

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

Exams that ask this topic