选择排序
-选择排序的特点
- 不稳定
- 时间复杂度 O(N^2)
- 空间复杂度 ( O(1) )
- 选择排序的原理
此处以升序为例
-选择排序的代码
public static void selsctSort(int[] arr){
int bound = 0;
for(; bound < arr.length; bound++){
for(int cur = bound + 1; cur < arr.length; cur++){
if(arr[bound] > arr[cur]){
int tem = arr[bound];
arr[bound] = arr[cur];
arr[cur] = tem;
}
}
}
}