标签:ons UNC cat lse ret OLE index spl fun
function quiktSort(arr){ var left = [],right = []; if(arr.length<1){ return arr; } var index = Math.floor(arr.length/2); var point = arr.splice(index,1); for(var i = 0,len = arr.length;i<len;i++){ if(arr[i]<point){ left.push(arr[i]); }else{ right.push(arr[i]); } } return quiktSort(left).concat(point,quiktSort(right)) } var arr = [1,45,4,85,82,2]; console.log(quiktSort(arr))
标签:ons UNC cat lse ret OLE index spl fun
原文地址:https://www.cnblogs.com/ccyq/p/11335387.html