SOURCE

let arr=[3,7,4,2,2,4,7,9,5,2,1,4,6,663,22,11];

function quickSort(arr,left,right){
    if(left<right){
        let l = left;
        let r = right;
        let x = arr[l];
        while(l<r){
            while(l<r&& arr[r]>x){
                r--;
            }
            if(l<r){
                arr[l++] = arr[r];
            }
            while(l<r && arr[l]<x){
                l++;
            }
            if(l<r){
                arr[r--] = arr[l];
            }
        }
        arr[l] = x;
        quickSort(arr,left,l-1);
        quickSort(arr,l+1,right);
    }
}
quickSort(arr,0,arr.length-1)
console.log(arr)
console 命令行工具 X clear

                    
>
console