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,34 @@
import system'routines;
import extensions;
extension op
{
bubbleSort()
{
var list := self.clone();
bool madeChanges := true;
int itemCount := list.Length;
while (madeChanges)
{
madeChanges := false;
itemCount -= 1;
for(int i := 0, i < itemCount, i += 1)
{
if (list[i] > list[i + 1])
{
list.exchange(i,i+1);
madeChanges := true
}
}
};
^ list
}
}
public program()
{
var list := new int[]{3, 7, 3, 2, 1, -4, 10, 12, 4};
console.printLine(list.bubbleSort().asEnumerable())
}