Skip to content
Related Articles
Open in App
Not now

Related Articles

ISRO | ISRO CS 2018 | Question 10

Improve Article
Save Article
  • Difficulty Level : Medium
  • Last Updated : 09 Jul, 2018
Improve Article
Save Article

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

(A) m x n
(B) maximum of m and n
(C) minimum of m and n
(D) m + n – 1

Answer: (D)

Explanation: To merge two lists of size m and n, we need to do m+n-1 comparisons in worst case. Since we need to merge 2 at a time, the optimal strategy would be to take smallest size lists first. The reason for picking smallest two items is to carry minimum items for repetition in merging.

So, option (D) is correct.

Quiz of this Question

My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!