We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
var quickSort = function(arr) { if(arr.length<=1) {return arr}; var pivotIndex = Math.floor(arr.length / 2); var pivot = arr.splice(pivotIndex,1)[0]; var left = []; var right = []; for(var i=0;i<arr.length;i++){ if(arr[i]<pivot){ left.push(arr[i]); }else{ right.push(arr[i]); } } return quickSort(left).concat([pivot], quickSort(right)); }
The text was updated successfully, but these errors were encountered:
前段时间在知乎上,看到有人在分析这一版。
Sorry, something went wrong.
@qingzhu1224 是的,很多人都说阮老师这样的快排是错的。其实我不大赞成。。。
No branches or pull requests
The text was updated successfully, but these errors were encountered: