But then we are not using the other property of the array that it's columns are sorted
On Feb 7, 6:33 pm, jagannath prasad das <[email protected]> wrote: > u can merge first two rows and proceed two at time.then slowly merge 4 at a > tym and so on.........a recursive algo will do > > On Mon, Feb 7, 2011 at 6:25 PM, Ashish Goel <[email protected]> wrote: > > yet to test... > > will download xcode to compile, not on linux or windows (: > > > remote case of all both entries in last row or last col needs to be > > looked.. > > > int ai=1; int bi=0;int aj=0; int bj=1; > > int row = 0; int col=0; > > printf("%d \n", a[0][0]); > > while ((ai<m)&&(bj<n)) > > { > > if (arr[ai][aj]<arr[bi][bj]) > > { > > printf("%d \n", a[ai][aj]); > > ai++; > > if (!(ai<m)) > > { > > ai=row+1; > > aj=++col; > > } > > } > > else > > { > > printf("%d \n", a[bi][bj]); > > bj++; > > if (!(bj<n)) > > { > > bi=++row; > > bj=col+1; > > } > > } > > } > > > } > > Best Regards > > Ashish Goel > > "Think positive and find fuel in failure" > > +919985813081 > > +919966006652 > > > On Mon, Feb 7, 2011 at 2:20 PM, jalaj jaiswal > > <[email protected]>wrote: > > >> here is the counter example.. below every row is sorted and every column > >> is sorted > > >> 0 2 3 4 > >> 0 3 4 5 > >> 1 4 5 6 > >> 2 5 6 7 > > >> On Mon, Feb 7, 2011 at 2:17 PM, Rajiv Podar <[email protected]>wrote: > > >>> Printing in the normal order will print the sorted output..... starting > >>> from Value[0][0] to value [m][n]. > >>> OR > >>> Please provide a e.g. array which need to be printed if I am wrong. > > >>> Thanks & Regards, > >>> Rajiv Podar > > >>> On Mon, Feb 7, 2011 at 2:13 PM, jalaj jaiswal <[email protected] > >>> > wrote: > > >>>> You are given a array with rows sorted and column sorted. You have to > >>>> print entire array in sorted order. > > >>>> -- > >>>> With Regards, > >>>> *Jalaj Jaiswal* (+919019947895) > >>>> Software developer, Cisco Systems > >>>> Final Year Undergraduate, > >>>> IIIT ALLAHABAD > > >>>> -- > >>>> 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. > > >> -- > >> With Regards, > >> *Jalaj Jaiswal* (+919019947895) > >> Software developer, Cisco Systems > >> Final Year Undergraduate, > >> IIIT ALLAHABAD > > >> -- > >> 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.
