let numArray = [2, 3, 5, 10, 6, 8, 3, 1, 9, 12, 15, 4];
let nums = numArray.concat();
function findStander(arr, low, high) {
if (low < high) {
let base = arr[low];
let l = low;
let h = high;
while (l < h) {
while (l < h && arr[h] >= base) {
h--;
}
arr[l] = arr[h];
while (l < h && arr[l] <= base) {
l++;
}
arr[h] = arr[l];
}
arr[l] = base;
return l;
}
}
function quickSort(arr, low = 0, high = arr.length - 1) {
if (low >= high) return
var stand = findStander(arr, low, high);
console.log(`arr: ${arr}, stand: ${stand}`);
quickSort(arr, low, stand - 1);
quickSort(arr, stand + 1, high);
}
quickSort(nums)
console.log(nums)