Use k-way merging +1. 1. Before the merging start, sorting these lists according to the first element of each list. // O(k log k) 2. So the first element in the first list is the smallest element. Put the smallest into the result array. // O(1) 3. Then, using binary search to find the new position of the first list // O(k) 4. These lists are still sorted, so the first element in the first list is still smallest. Just repeat the step 2, 3 n times.
-- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.