all tasks
This commit is contained in:
parent
b83f433714
commit
68f8f3e56b
14735 changed files with 178959 additions and 0 deletions
|
|
@ -0,0 +1,14 @@
|
|||
function bubbleSort(A)
|
||||
local itemCount=#A
|
||||
local hasChanged
|
||||
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
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
list = { 5, 6, 1, 2, 9, 14, 2, 15, 6, 7, 8, 97 }
|
||||
bubbleSort(list)
|
||||
for i, j in pairs(list) do
|
||||
print(j)
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue