Sorting algorithms/Bubble sort: Difference between revisions
Content added Content deleted
(Corrected Actionscript implementation.) |
|||
Line 682: | Line 682: | ||
}.do_while {!sorted}; |
}.do_while {!sorted}; |
||
);</lang> |
);</lang> |
||
=={{header|Lua}}== |
|||
<lang Lua> |
|||
function bubbleSort(A) |
|||
itemCount=#A |
|||
repeat |
|||
hasChanged = false |
|||
itemCount=itemCount - 1 |
|||
for i = 1, itemCount do |
|||
if A[i] > A[i + 1] then |
|||
A[i], A[i + 1] = A[i + 1], A[i] |
|||
hasChanged = true |
|||
end |
|||
end |
|||
until hasChanged == false |
|||
end |
|||
</lang> |
|||
=={{header|Lucid}}== |
=={{header|Lucid}}== |