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,22 @@
var stoogeSort // recursive
stoogeSort = Fn.new { |a, i, j|
if (a[j] < a[i]) {
var t = a[i]
a[i] = a[j]
a[j] = t
}
if (j - i > 1) {
var t = ((j - i + 1)/3).floor
stoogeSort.call(a, i, j - t)
stoogeSort.call(a, i + t, j)
stoogeSort.call(a, i, j - t)
}
}
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)")
stoogeSort.call(a, 0, a.count-1)
System.print("After : %(a)")
System.print()
}