@shady : http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.22.5514&rep=rep1&type=pdf
it is not easy to merge sorted array inplace. check this link..hope this help. On Wed, Jan 11, 2012 at 4:53 PM, shady <[email protected]> wrote: > any idea on how to merge two sorted arrays of size m and size n in O(m+n) > time and without extra space ? > > > On Wed, Jan 11, 2012 at 3:22 PM, Dipit Grover <[email protected]>wrote: > >> @ all k-way people : I dont get it how the complexity would be O(m*n) . I >> just went through the algo and I feel that one would need to find the >> minimum element among the head-elements of all individual row-arrays, for >> all the resulting m*n elements. I say so since we may not necessarily have >> a sorted column-array(array formed by taking the head elements of each >> row-array) each time we look for the min element. Please correct me if I am >> wrong. >> >> @Lucifer- yeah we need to only traverse the columns till the current >> column. >> >> -- >> 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. >> > > -- > 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. > -- 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.
