Give a O(nlogk) time algorithm to merge k sorted list into one sorted list,
where n is the total number of elements in all the input list.

My approach:

1. take first element from all the k sorted list and build heap for those
elements.
2. call heapify on all k elements to sort it.
3. repeat the above two steps for all n elements.

Complexity:
1. building a heap of k element takes O(klogk).
2. heapifying on each k elements takes O(klogk).
3. repeat the above steps n  times = 0(nlogk).

Is my approach and understanding correct?

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to