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 <jalaj.jaiswa...@gmail.com>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 <rajeevpo...@gmail.com> 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 >> <jalaj.jaiswa...@gmail.com>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 algogeeks@googlegroups.com. >>> To unsubscribe from this group, send email to >>> algogeeks+unsubscr...@googlegroups.com. >>> 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 algogeeks@googlegroups.com. >> To unsubscribe from this group, send email to >> algogeeks+unsubscr...@googlegroups.com. >> 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 algogeeks@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com. > 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.