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

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

  1. A. 7
  2. B. 14
  3. C. 6
  4. D. 8

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