Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function quicksort(arr) {
- var i;
- var len = arr.length;
- var iter = 1;
- while (iter < len) {
- for (i = 0; i <= len; i++) {
- if (i != (len - 1)) {
- if (arr[i] > arr[i + 1]) {
- var TEMP = arr[i + 1];
- arr[i + 1] = arr[i];
- arr[i] = TEMP;
- }
- }
- }
- iter++;
- }
- return arr;
- }
- /**
- * Minified one-liner.
- *
- * function quicksort(r){for(var f,n=r.length,o=1;n>o;){for(f=0;n>=f;f++)if(f!=n-1&&r[f]>r[f+1]){var t=r[f+1];r[f+1]=r[f],r[f]=t}o++}return r}
- *
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement