选择排序
1.先求最小值
2.找到地位
3.把地位的数放到有序区
4.反复
for (int j = 0; j < count - 1; j++) {
int minIndex = j;// 最小值的角标
for (int i = minIndex + 1; i < count; i++) {
if (array[minIndex] > array[i]) {
minIndex = i;
}
}
if (minIndex != j) { // 优化 无序区的头 不是第一个
// 最小值 放入头部
int temp;
temp = array[minIndex];
array[minIndex] = array[j];
array[j] = temp;
}
}