Monday, 25 May 2015

Q51,paper 3,D12.Suppose there are logn sorted lists of n logn elements each. The time complexity of producing a sorted list of all these elements is (use heap data structure)



(A) O (n log logn)
(B) q(n logn)
(C) W(n logn)
(D) W(n3/2)

Explanation.
Explanation:
Let n=8
Total arrays 3 = log8.
Total element in array= nlogn
let we have 3 array to be merged.  Each array has 24 element. Insertion  in heap takes log n so total time is 72log24.= 72log8*3
hence  we an write whole equation as. 72log log n.=O(nloglog n).

No comments:

Post a Comment

Note: only a member of this blog may post a comment.