Initial data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 72d218235f
commit f23f22d71c
199087 changed files with 3378941 additions and 0 deletions

View file

@ -0,0 +1,28 @@
var combSort = Fn.new { |a|
var gap = a.count
while (true) {
gap = (gap/1.25).floor
if (gap < 1) gap = 1
var i = 0
var swaps = false
while (true) {
if (a[i] > a[i+gap]) {
var t = a[i]
a[i] = a[i+gap]
a[i+gap] = t
swaps = true
}
i = i + 1
if (i + gap >= a.count) break
}
if (gap == 1 && !swaps) return
}
}
var as = [ [4, 65, 2, -31, 0, 99, 2, 83, 782, 1], [7, 5, 2, 6, 1, 4, 2, 6, 3] ]
for (a in as) {
System.print("Before: %(a)")
combSort.call(a)
System.print("After : %(a)")
System.print()
}