my algo :
1.Construct a max(min) heap from first element of all array,
2. extract a max(min) value from the heap and write to output
3. get one more element from array which the value extracted step 2 was in.
4. repeat until heap is not empty
can anyone tell me complexity of this ? according to me it is mnlogm where m is no of arrays and n is no of elements in each array. thanks.
secodnly, can we do better than this ? i have m sorted arrays and n elements in each array. i have another array of m*n elements space. so how can i merge it in most efficient way ? thanks. one of algo is given above , can we think of better ? thanks.