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,31 @@
bundle Default {
class Stooge {
function : Main(args : String[]) ~ Nil {
nums := [1, 4, 5, 3, -6, 3, 7, 10, -2, -5];
StoogeSort(nums);
each(i : nums) {
IO.Console->Print(nums[i])->Print(",");
};
IO.Console->PrintLine();
}
function : native : StoogeSort(l : Int[]) ~ Nil {
StoogeSort(l, 0, l->Size() - 1);
}
function : native : StoogeSort(l : Int[], i : Int, j : Int) ~ Nil {
if(l[j] < l[i]) {
tmp := l[i];
l[i] := l[j];
l[j] := tmp;
};
if(j - i > 1) {
t := (j - i + 1) / 3;
StoogeSort(l, i, j - t);
StoogeSort(l, i + t, j);
StoogeSort(l, i, j - t);
};
}
}
}