If we use K merge I think the time complexity would be nm lognm I think we must try doing in O(m*n)
On Wed, Jan 11, 2012 at 1:54 PM, Ankur Garg <[email protected]> wrote: > @Shady Rows are already sorted ... > > > On Wed, Jan 11, 2012 at 1:53 PM, shady <[email protected]> wrote: > >> ^^ true, sort the rows and then a K-way merge. >> >> >> On Wed, Jan 11, 2012 at 1:00 PM, Sanjay Rajpal <[email protected]>wrote: >> >>> I guess sort the array such that elements are sorted finally in such a >>> way that if we print them row by row, the result is a sorted array. >>> >>> K-way merge can be useful. >>> * >>> Sanjay Kumar >>> B.Tech Final Year >>> Department of Computer Engineering >>> National Institute of Technology Kurukshetra >>> Kurukshetra - 136119 >>> Haryana, India >>> Contact: +91-8053566286 >>> * >>> >>> >>> >>> On Tue, Jan 10, 2012 at 11:28 PM, prakash y <[email protected]>wrote: >>> >>>> "sort the whole matrix in ascending array" means? >>>> can you please explain ? >>>> >>>> >>>> On Wed, Jan 11, 2012 at 12:53 PM, atul anand >>>> <[email protected]>wrote: >>>> >>>>> Given 2D array. >>>>> >>>>> The rows are sorted in ascending order and the colums are sorted in >>>>> ascending order. >>>>> >>>>> We have to sort the whole matrix in ascending array. >>>>> >>>>> We cannot use extra space. >>>>> >>>>> -- >>>>> 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. >>> >> >> -- >> 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.
