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,33 @@
import extensions;
import system'routines;
extension op
{
selectionSort()
{
var copy := self.clone();
for(int i := 0, i < copy.Length, i += 1)
{
int k := i;
for(int j := i + 1, j < copy.Length, j += 1)
{
if (copy[j] < copy[k])
{
k := j
}
};
copy.exchange(i,k)
};
^ copy
}
}
public program()
{
var list := new string[]{"this", "is", "a", "test", "of", "generic", "selection", "sort"};
console.printLine("before:",list.asEnumerable());
console.printLine("after:",list.selectionSort().asEnumerable())
}