C#排序算法(二)选择排序(Selection)
来源:互联网 发布:php和js的区别 编辑:程序博客网 时间:2024/06/05 03:57
using System;
namespace SelectionSorter
{
public class SelectionSorter
{
private int min;
public void Sort(int [] list)
{
for(int i=0;i<list.Length-1;i++)
{
min=i;
for(int j=i+1;j<list.Length;j++)
{
if(list[j]<list[min])
min=j;
}
int t=list[min];
list[min]=list[i];
list[i]=t;
}
}
}
public class MainClass
{
public static void Main()
{
int[] iArrary = new int[]{1,5,3,6,10,55,9,2,87,12,34,75,33,47};
SelectionSorter ss=new SelectionSorter();
ss.Sort(iArrary);
for (int m=0;m<iArrary.Length;m++)
Console.Write("{0} ",iArrary[m]);
Console.WriteLine();
}
}
}
- C#排序算法(二)选择排序(Selection)
- 算法--选择排序 Selection Sort
- 经典排序算法 - 选择排序Selection sort
- 经典排序算法 - 选择排序Selection sort
- 经典排序算法 - 选择排序Selection sort
- 排序算法-选择排序 Selection Sort
- 经典排序算法 - 选择排序Selection sort
- 排序算法---选择排序(Selection Sort)
- 【排序算法】 选择排序 selection sort(选择类排序)
- 选择排序(selection sort)算法实现
- 选择排序算法——Selection Sort
- 选择排序(selection sort)算法实现
- 选择排序算法(Selection Sort)
- 选择排序(selection sort)
- 选择排序(Selection Sort)
- selection sort 选择排序
- 选择排序 Selection Sort
- 选择排序(Selection Sort)
- Solution of ArrayIndexOutOfBoundsException while extractor Microsoft Format Files with POI
- 通过socket连接传递java对象(对象序列化)
- 做最好的自己,做一个真正的奋青
- 做最好的自己,做一个真正的奋青
- C#排序算法(一)冒泡排序(Bubble)
- C#排序算法(二)选择排序(Selection)
- Zend Studio For Eclipse 6.0 正版注册码!
- 读书笔记-Thinking in C++-第11章 引用和拷贝构造函数
- C#排序算法(三)插入排序(InsertionSorter)
- HttpWebRequest 向网站提交数据
- 互联网时代计算机视觉为王
- MsSql 2000数据还原到MsSql 2005 脚本
- 各种同步问题的代码(JAVA)
- C++_cast