in Algorithms
521 views
0 votes
0 votes

explain how to solve the above question !

in Algorithms
521 views

4 Comments

For eg: consider a worst case input of 2 list.

1,3,5    and  2,4,6 -  when we 'merge' them using merge function we only requires 5 comparisons(6-1) to form 1 2 3 4 5 6.

In the main question ,lets name the  16 element sorted lists as A,B,C,D

A and B are combined - 31 comparisons( 32-1)

C and D -31 comparisons

then AB and CD are combined (64-1 =63 comparisons) (AB and CD are combined list of 32 elements each).

So total comparisons 31+31+63=125

Thats the logic I followed.

I dont see how they are getting the value of '2n-3'. I am getting 'n-2' when I solve that equation,
0
0
Got it ..! Thanks bro
1
1
You are welcome :)
1
1

Please log in or register to answer this question.