Skip to content
Related Articles

Related Articles

ISRO | ISRO CS 2018 | Question 10
  • Last Updated : 09 Jul, 2018

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

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.

My Personal Notes arrow_drop_up
Recommended Articles
Page :