标签:pre stat 选择 public for ati ++ sel oid
选择排序
public class TestSort {
public static void selectSort(int[] a) {
int index, temp;
for (int i = 0; i < a.length - 1; i++) {
index = i;
for (int j = i + 1; j < a.length; j++) {
if (a[j] < a[index]) {
index = j;
}
}
if (i != index) {
temp = a[i];
a[i] = a[index];
a[index] = temp;
}
}
}
}
标签:pre stat 选择 public for ati ++ sel oid
原文地址:https://www.cnblogs.com/hglibin/p/11370949.html