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
- A.
m × n
- B.
maximum of m, n
- C.
minimum of m, n
- 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.