标签:
//选择排序 static void SelectSort(int[] myArray) { int smallIndex; for (int i = 0; i < myArray.Length-1; i++) { smallIndex = i; for (int j = i+1; j <myArray.Length; j++) { if (myArray[j] < myArray[smallIndex]) { smallIndex = j; } } Swap(ref myArray[smallIndex],ref myArray[i]); } } static void Swap(ref int left, ref int right) { int temp; temp = left; left = right; right = temp; }
标签:
原文地址:http://www.cnblogs.com/greyhh/p/4709591.html