Sorting algorithms/Bubble sort: Difference between revisions

Line 687:
<lang Lua>
function bubbleSort(A)
local itemCount=#A
local hasChanged
repeat
hasChanged = false
Line 693 ⟶ 694:
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
Anonymous user