Hi ,

here goes the code..

let's say you have an array of n numbers.Here n could be 1,2,3......

it goes as follows:

function bubblesort (A : list[1..n]) {
    var int i, j;
    for i from n downto 1 {
        for j from 1 to i-1 {
            if (A[j] > A[j+1])
                swap(A[j], A[j+1])
        }
    }
}

this is the simplest algo.hope you can implement this in java...

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/algogeeks
-~----------~----~----~----~------~----~------~--~---

Reply via email to