• retagged by
2,606 views
2 2 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

2 Answers

2 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

Position:
Show:

Related questions

1 1 vote
4 4 answers
5.6k
5.6k views
iarnav asked Apr 25, 2019
5,644 views
In Merge sort Algorithm when I took input array of size 2 and I got 4 function calls as including original function call with which I call MS algorithm i.e. MS (1,2) and ...
1 1 vote
2 2 answers
6.0k
6.0k views
Shubhanshu asked Dec 1, 2018
5,952 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 1 vote
0 0 answers
1.1k
1.1k views
1 1 vote
1 1 answer
2.1k
2.1k views
rahul sharma 5 asked Mar 9, 2018
2,139 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?...