all tasks

This commit is contained in:
Ingy döt Net 2013-04-11 01:07:29 -07:00
parent b83f433714
commit 68f8f3e56b
14735 changed files with 178959 additions and 0 deletions

View file

@ -0,0 +1,27 @@
using System;
using System.Console;
module Selection
{
public static Sort[T](this a : array[T]) : void
where T : IComparable
{
mutable k = 0;
def lastindex = a.Length - 1;
foreach (i in [0 .. lastindex])
{
k = i;
foreach (j in [i .. lastindex])
when (a[j].CompareTo(a[k]) < 0) k = j;
a[i] <-> a[k];
}
}
Main() : void
{
def arr = array[6, 2, 8, 3, 9, 4, 7, 3, 9, 1];
arr.Sort();
foreach (i in arr) Write($"$i ");
}
}