Sorting algorithms/Bubble sort: Difference between revisions
Content added Content deleted
Not a robot (talk | contribs) (Add Draco) |
|||
Line 2,149: | Line 2,149: | ||
while !done { |
while !done { |
||
done = true |
done = true |
||
for i in 1..(list. |
for i in 1..(list.Length()-1) { |
||
if list[i - 1] > list[i] { |
if list[i - 1] > list[i] { |
||
var x = list[i] |
var x = list[i] |
||
Line 2,159: | Line 2,159: | ||
} |
} |
||
} |
} |
||
var xs = [3,1,5,4,2,6] |
var xs = [3,1,5,4,2,6] |
||
bubbleSort(xs) |
bubbleSort(xs) |