@Ankur.. Yes... If you follow the algo that i have presented above and use Atul's example you will be able to figure out..
Maybe, the confusion is regarding heapfying.. ryt?? I am assuming so.. Now as i said a submatrix rooted at A[i , j] is nothing but a heap where its subtrees share a few nodes... Now, the first thing is to visualize the heap... For a heap in the form of submatrix rooted at A[i][j], its children are subtrees in the form of submatrix rooted at A[i+][j] and A[i][j +1]... Now, imagine that you apply the normal heap-stabilizing approach when the root element of a heap is being replaced by some other value... Do it for an example submatrix (identified as explained above and also whose rows and columns are sorted) and you will see how it works... On Jan 11, 4:44 pm, Dipit Grover <dipitgro...@gmail.com> wrote: > @Shady : you would definitely need two index variables for each array I > feel. -- 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.