• retagged by
726 views
0 0 votes
In the standard merge sort algorithm on a list of size n, what is the maximum number of times an item can be compared?

1 Answer

0 0 votes
The element be let in any of these 2^k elements  and once our element is compared within sub-array , it will not again compared with any element within sub-array again.

Total comparison of an item = n/2+ n/(2^2)+. . . . +  n/(2^k)    where n/(2^k) =1

                                          = n*(1-1/(2^k))

                                          = n - n/(2^k)

                                          = n-1
Position:
Show:

Related questions

1 1 vote
1 1 answer
182
182 views
GO Classes asked Aug 10
182 views
Mergesort recursively sorts the two halves of an array.After both recursive calls have finished, but before the merge operation, which statement must be true?The complete...
3 3 votes
1 1 answer
281
281 views
GO Classes asked Aug 4
281 views
Assume that a merge sort algorithm in the worst case takes $30$ seconds for an input of size $64$. Which of the following most closely approximates the maximum input size...
2 2 votes
1 1 answer
193
193 views
GO Classes asked Aug 4
193 views
Suppose instead of dividing the input into two parts, a modified merge sort divides the input into four equal parts, sorts each one-fourth recursively, and finally combin...
3 3 votes
1 1 answer
221
221 views
GO Classes asked Aug 4
221 views
Merge sort divides an array of size $n$ into two halves, recursively sorts both halves, and then merges the two sorted halves.Which recurrence correctly represents merge ...