in Algorithms edited by
2,425 views
1 vote
1 vote

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. $m \times n$
  2. maximum of $m$ and $n$
  3. minimum of $m$ and $n$
  4. $m+n-1$
in Algorithms edited by
by
2.4k views

1 Answer

3 votes
3 votes
Best answer

option d

worst case comparisons in merge sort is o(m+n-1)

selected by

5 Comments

Why not C .....Both  list are  already Sorted after minimum of (m,n) no. of comparison all remaining element  get copied without comparison.

0
0
consider the below two lists which are sorted but requries 'm+n-1'  comparissions

 

{11,13,15,17},{12,14,16,18}
1
1
How many for best case ??
1
1
min(m,n)
0
0
It depends , either max(m,n) or min(m,n) . Out of these two cases , one of the answer is possible and which one is to choose out of these two is completely depends on particular arrays .
0
0
Answer:

Related questions