算法实现
public static void SelectSort(int [] arr,int n){ for (int i = 0; i < n - 1; i++) { int index = i; int j; // 找出最小值得元素下标 for (j = i + 1; j < n; j++) { if (arr[j] < arr[index]) { index = j; } } int tmp = arr[index]; arr[index] = arr[i]; arr[i] = tmp; System.out.println(Arrays.toString(arr)); } }