選擇排序
class SelectionSorter
{
private int min;
public void Sort(int[] arr)
{
for (int i =
{
min = i;
for (int j = i +
{
if (arr[j] < arr[min])
min = j;
}
int t = arr[min];
arr[min] = arr[i];
arr[i] = t;
}
}
static void Main(string[] args)
{
int[] array = new int[] {
SelectionSorter s = new SelectionSorter();
s
foreach (int m in array)
Console
}
}
From:http://tw.wingwit.com/Article/program/ASP/201311/21872.html