Friday, February 28, 2014

Merge N sorted array ??????????

Make a heap from the first element in each array.
Pop the head element from the heap, insert it into the result array, and then take the next element from the array the head of the heap came from, and insert that into the heap.
Repeat until you consume all of the arrays.

No comments:

Post a Comment