Given two sorted list of size 'm' and 'n' respectively. The number of…

2023

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

  1. A.

    m × n

  2. B.

    maximum of m, n

  3. C.

    minimum of m, n

  4. D.

    m + n – 1

Attempted by 172 students.

Show answer & explanation

Correct answer: D

Explanation: Each comparison places one element into the final sorted array. In the worst case, m + n - 1 comparisons are necessary.

Explore the full course: Coding For Placement