other-file.js 889 B

1234567891011121314151617181920212223242526272829
  1. // Another file for symbols to exist in. Used for project search.
  2. var quicksort = function () {
  3. var sort = function (items) {
  4. if (items.length <= 1) return items;
  5. var pivot = items.shift(), current, left = [], right = [];
  6. while(items.length > 0) {
  7. current = items.shift();
  8. current < pivot ? left.push(current) : right.push(current);
  9. }
  10. return sort(left).concat(pivot).concat(sort(right));
  11. };
  12. return sort(Array.apply(this, arguments));
  13. };
  14. var quicksort2 = function () {
  15. var sort = function (items) {
  16. if (items.length <= 1) return items;
  17. var pivot = items.shift(), current, left = [], right = [];
  18. while(items.length > 0) {
  19. current = items.shift();
  20. current < pivot ? left.push(current) : right.push(current);
  21. }
  22. return sort(left).concat(pivot).concat(sort(right));
  23. };
  24. return sort(Array.apply(this, arguments));
  25. };