retagged by
1,723 views
1 votes
1 votes
Consider bottom- up merge sort working on 'n' elements . Assume n is a power of 2. The minimum number of comparisons in order to get sorted list is

a) n log n/2

b)n log n-n+1

c)n logn

d)n logn +n
retagged by

1 Answer

2 votes
2 votes

None of the above

             1,2,3,4            = 2 comparison   Final sorted array

     1,2              3,4       = 2 comparison   2nd level

       1  2  3  4              Individually sorted elements

Minimum comparison is only possible when 1st and last element of either array are smaller then first element of another

so in such as case at each level we will have n/2 comparisons

In general= n/2 * number of levels

= $\frac{n}{2}log_{2}n$

For n=2  only 1 comparison

For n=4 only 4 Comparison and so on

Related questions

1 votes
1 votes
2 answers
2
Shubhanshu asked Dec 1, 2018
5,079 views
Is Quick sort an adaptive sorting Algorithm? I think no. Because as per the definition given in the Wikipedia is that A adaptive sorting Algorithm is one who takes the ad...
1 votes
1 votes
0 answers
3
1 votes
1 votes
1 answer
4
rahul sharma 5 asked Mar 9, 2018
1,314 views
Consider the modified merge sort where we divide array into 5 equal sub arrays instead if 2(as in standard merge sort).What is the time complexity if modified merge sort?...