本文实例讲述了C#选择法排序实现方法。分享给大家供大家参考。具体实现方法如下:
public int[] SelectionSort(int[] arr)
{
//1. Find min
//2. Swap it with first element
//3. Repeat starting from secong position onwards.
int _min = 0;
for (int i = 0; i < arr.Length; i++)
{
本文实例讲述了C#选择排序法。分享给大家供大家参考。具体如下:
public static void SelectSort (int[] list)
{
for (int i = 0; i < list.Length; i++)
{
int min = i;
for (int j = i + 1; j < list.Length; j++)
if(list [j] < list [min])
min = j;
if(min !