@lucifer:nice explanation !... just to make a small clarification, in your stabilisation part u jus compare x with min (b,d) , make a swap if necessary and then next time u compare it shud be <=min(b,d) and so u break.
x b c d e f g h i so now after breaking x is less than both b and d but present b could be greater than e right? for example initally it cud be 8 5.... 6 7..... . . . and we swap 8 and 5....now 8 is above 7 after swap ...but is this taken care of next iteration when we do swaps of a[row][col] with a[row+1][0]?? so is heapify sep in all just comparison of x with b and d only and swap if needed?? On Sat, Jan 14, 2012 at 1:48 AM, Gaurav Kalra <[email protected]> wrote: > Bases on algorithm suggested by Lucifer, I have coded the problem in C > (please see attachment). > > The code has been tested against the following test cases: > > 1 3 4 8 9 > 2 5 18 25 50 > 6 7 22 45 55 > > and > > 1 2 7 > 3 5 8 > 4 6 9 > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/algogeeks/-/kQ0gKL_2h7oJ. > > 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. > -- "People often say that motivation doesn't last. Well, neither does bathing - that's why we recommend it daily." -- 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.
