Skip to content

ISRO Scientist/Engineer CSE 2018Algorithms › Sorting

ISRO Scientist/Engineer CSE 2018 PYQ: Given two sorted list of size $m$ and $n$ respectively. The number of comparisons needed the worst case by…

Given two sorted list of size $m$ and $n$ respectively. The number of comparisons needed the worst case by the merge sort algorithm will be:

  1. A
    $m \times n$
  2. B
    maximum of $m$ and $n$
  3. C
    minimum of $m$ and $n$
  4. D
    $m+n-1$
    Correct answer

Answer

(D) $m+n-1$

Approach

The question asks for the worst-case number of comparisons performed by the merge step of merge sort when combining two already-sorted lists of sizes $m$ and $n$. The key insight is that each comparison places exactly one element into the output, and the process stops comparing once one list is exhausted.

Reviewed by ISRO IQ Editorial Team.