905 views
2 votes
2 votes

we are given (log m) sorted list each of size (log n) / (log m) the time complexity of merging list into single sorted list using mergesort is equal to 

a) O ( log m log(log n) )

​​​​​​​b) O ( log n log(log m) )

​​​​​​​c) O ( log m log n)

​​​​​​​d) O ( m log log n)

1 Answer

4 votes
4 votes
we have logm list of size  logn/logm---

so in each step we have to merge two list and in each step all the comparisons will take ((logm X logn)/logm)= logn time

and we have to do merging till k th step in which 2^k= logm (2^k beause in each step we are merging two list)

                                                                     k= log(log m)    

                                                        so

                                   Logn + log n + log n ...... for log(logm) times

                                    so complexity should be logn log(logm)

so answer should be B
edited by

Related questions

3 votes
3 votes
3 answers
1
ABKUNDAN asked Aug 21, 2017
5,742 views
suppose there are 4 sorted lists of n/4 elements each. if we merge these list into a single sorted list of n elements, for the n=400 number of key comparisons in the wors...
2 votes
2 votes
2 answers
2
1 votes
1 votes
2 answers
4