1234567891011121314151617181920212223242526272829 |
- // Another file for symbols to exist in. Used for project search.
- var quicksort = function () {
- var sort = function (items) {
- if (items.length <= 1) return items;
- var pivot = items.shift(), current, left = [], right = [];
- while(items.length > 0) {
- current = items.shift();
- current < pivot ? left.push(current) : right.push(current);
- }
- return sort(left).concat(pivot).concat(sort(right));
- };
- return sort(Array.apply(this, arguments));
- };
- var quicksort2 = function () {
- var sort = function (items) {
- if (items.length <= 1) return items;
- var pivot = items.shift(), current, left = [], right = [];
- while(items.length > 0) {
- current = items.shift();
- current < pivot ? left.push(current) : right.push(current);
- }
- return sort(left).concat(pivot).concat(sort(right));
- };
- return sort(Array.apply(this, arguments));
- };
|