https://www.cnblogs.com/zwtgyh/p/10631760.html—PATHON
https://www.cnblogs.com/fnlingnzb-learner/p/9083552.html—JAVA
快速排序算法
int[] arr = {49, 38, 65, 97, 76, 13, 27, 49, 78, 34, 12, 64, 1};
for (int i = 1; i < arr.length; i++) {
int temp = arr[i]; //要插入的第i个元素
int low = 0;
int high = i - 1; //插入目标元素的前 i-1 个元素
int mid = -1;
while (low <= high) {
mid = low + (high - low) / 2;
if (arr[mid] > temp) {
high = mid - 1;
} else { // 元素相同时,也插入在后面的位置
low = mid + 1;
}
}
// 目标位置 之后的元素 整体移动一位
for(int j = i - 1; j >= low; j--) {
arr[j + 1] = arr[j];
}
arr[low] = temp;
}
for (int i = 0; i < arr.length ; i++) {
System.out.print(arr[i]+" ");
}