您的位置:首页 > 编程语言 > C#

(C#)选择排序 Selection Sort

2011-01-06 23:55 411 查看
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Sort
{
class Select
{
public static void SelectSort(List<int> list)
{
int tmp;
int t;
for (int i = 0; i < list.Count; ++i)
{
t = i;
for (int j = i + 1; j < list.Count; ++j)
{
if (list[t] > list[j])
{
t = j;
}
}
tmp = list[i];
list[i] = list[t];
list[t] = tmp;
}
}
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: