edited by
600 views
2 votes
2 votes

 my answer don't match any answer plz chec

edited by

1 Answer

Best answer
5 votes
5 votes
Let's assume $ k = 2^m $

Then to merge two lists of size n it takes  $ c_1 * n $ and there are $ k/2 $ such lists thus = $ c_1 * n * (k/2) $

Then to merge two lists of size 2n it takes  $ c_2* n $ and there are $ k/4 $ such lists thus = $ c_2 * n * (k/4) $

 - - - - - - - --  - - - -

Then to merge two lists of size $ 2^{m-1} $ it takes  $ c_{m-1}*n $ and there are $ k/2^{m-1} $ such lists thus = $ c_{m-1} * n * k/2^{m-1} $

if $ c_1 = c_2=------------=c_{m-1} $

thus total time = $ O(kn\log{k}) $
selected by

Related questions

0 votes
0 votes
0 answers
2
2 votes
2 votes
2 answers
3
ajit asked Sep 5, 2015
3,786 views
Suppose there are $\log n$ sorted lists and each list contains $n/\log n$ elements. The time complexity of producing a sorted list of all these elements is (using merge a...