This commit is contained in:
2024-08-24 22:41:08 +02:00
parent 77f1ac5d7a
commit c21f59778f
431 changed files with 68581 additions and 68581 deletions

View File

@@ -1,19 +1,19 @@
local array = {13, 14, 52, 63, 764, 12342, 143, 2, 54, 63, 25, 15}
local sortedarray = {0}
for ka, va in ipairs(array) do
for j = 1, #sortedarray do
if va > sortedarray[j] then
if sortedarray[j] > 0 then
for i = #sortedarray, j, -1 do
sortedarray[i + 1] = sortedarray[i]
end
end
sortedarray[j] = va
end
end
end
for k, v in ipairs(sortedarray) do
print(k, v)
end
local array = {13, 14, 52, 63, 764, 12342, 143, 2, 54, 63, 25, 15}
local sortedarray = {0}
for ka, va in ipairs(array) do
for j = 1, #sortedarray do
if va > sortedarray[j] then
if sortedarray[j] > 0 then
for i = #sortedarray, j, -1 do
sortedarray[i + 1] = sortedarray[i]
end
end
sortedarray[j] = va
end
end
end
for k, v in ipairs(sortedarray) do
print(k, v)
end