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,27 @@
local fmt = require "fmt"
local function shell_sort(a)
local n = #a
local gaps = {701, 301, 132, 57, 23, 10, 4, 1}
for gaps as gap do
if gap < n then
for i = gap + 1, n do
local t = a[i]
local j = i
while j > gap and a[j - gap] > t do
a[j] = a[j - gap]
j -= gap
end
a[j] = t
end
end
end
end
local array = { {4, 65, 2, -31, 0, 99, 2, 83, 782, 1}, {7, 5, 2, 6, 1, 4, 2, 6, 3} }
for array as a do
fmt.print("Before: %,s", a)
shell_sort(a)
fmt.print("After : %,s", a)
print()
end