AsenLins
5/25/2019 - 6:19 PM

快速排序

快速排序

快速排序

A Pen by sam on CodePen.

License.

const ary=[9,8,7,6,5,4,3,2,1];
const pivotIndex=ary.length/2;
const pivot=ary[pivotIndex];
function splitAryByPivot(ary,pivot){
  const smallAry=[];
  const bigAry=[];
  
  for(var index=0;index<ary.length;index++){
    if(ary[index]>pivot){
      bigAry.push(ary[index]);
    }else if(ary[index]<pivot){
      smallAry.push(ary[index]);
    }
    return{
      smallAry,
      bigAry
    }
  }
}

function qucikSort(){
  
}