1,399 views
2 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 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
Position:
Show:

Related questions

3 3 votes
3 answers 3 answers
7.0k
7.0k views
ABKUNDAN asked Aug 21, 2017
7,012 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 2 votes
2 answers 2 answers
2.1k
2.1k views
Sanjay Sharma asked Jul 2, 2016
2,064 views
A list of integers is almost sorted with only the largest number being out of place. If this information is not known to the algorithm, then which of the following algori...
7 7 votes
2 2 answers
6.0k
6.0k views
Akash Mishra asked Nov 22, 2017
5,958 views
Which of the following operations can be performed in O(log n) time or faster on a sorted array A? (n denotes the size of array)1) Search(A, x)2) Find-Minimum(A)3) Delete...
1 1 vote
2 answers 2 answers
2.5k
2.5k views
Akriti sood asked Dec 27, 2016
2,461 views
Consider the array of size n. the first (n – 1) elements are already sorted. What is the worst case time complexity to insert a nth element in an array after insertion th...