Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,28 @@
fn combSort arr =
(
local gap = arr.count
local swaps = 1
while not (gap == 1 and swaps == 0) do
(
gap = (gap / 1.25) as integer
if gap < 1 do
(
gap = 1
)
local i = 1
swaps = 0
while not (i + gap > arr.count) do
(
if arr[i] > arr[i+gap] do
(
swap arr[i] arr[i+gap]
swaps = 1
)
i += 1
)
)
return arr
)

View file

@ -0,0 +1,4 @@
a = for i in 1 to 10 collect random 1 10
#(2, 6, 5, 9, 10, 7, 2, 6, 1, 4)
combsort a
#(1, 2, 2, 4, 5, 6, 6, 7, 9, 10)