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,19 @@
require "table2"
local function counting_sort(a, min, max)
local count = table.rep(max - min + 1, 0)
for a as n do count[n - min + 1] += 1 end
local z = 1
for i = min, max do
while count[i - min + 1] > 0 do
a[z] = i
z += 1
count[i - min + 1] -= 1
end
end
end
local a = {4, 65, 2, -31, 0, 99, 2, 83, 782, 1}
print($"Unsorted: \{{a:concat(", ")}")
counting_sort(a, a:min(), a:max())
print($"Sorted: \{{a:concat(", ")}")