Created
May 5, 2014 16:07
-
-
Save e7h4n/11540913 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function qs(arr) { | |
if (!arr || !arr.length) { | |
return []; | |
} | |
var split = arr.pop(); | |
return qs(arr.filter(function (item) { return item <= split; })) | |
.concat([split]) | |
.concat(qs(arr.filter(function (item) { return item > split; }))); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment