Data update

This commit is contained in:
Ingy döt Net 2026-04-30 12:34:36 -04:00
parent 4bb20c9b71
commit cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions

View file

@ -0,0 +1,22 @@
local function flip(a, r)
local l = 1
while l <= r do
a[r], a[l] = a[l], a[r]
l += 1
r -= 1
end
end
local function pancake_sort(a)
for uns = #a, 2, -1 do
local lg = a:slice(1, uns):max()
local lx = a:findindex(|e| -> e == lg)
flip(a, lx)
flip(a, uns)
end
end
local a = {31, 41, 59, 26, 53, 58, 97, 93, 23, 84}
print($"Before: \{{a:concat(", ")}}")
pancake_sort(a)
print($"After : \{{a:concat(", ")}}")