lib/merge-sort-bottom-up.js
function sort(array, compare) {
  var workArray = new Array(array.length);
  var chunkSize = 1;
  while (chunkSize < array.length) {
    var i = 0;
    while (i < array.length - chunkSize) {
      bottomUpMerge(array, i, chunkSize, workArray, compare);
      i += chunkSize * 2;
    }
    chunkSize *= 2;
  }
  return array;
}
function sort(array, compare) {
  var workArray = new Array(array.length);
  var chunkSize = 1;
  while (chunkSize < array.length) {
    var i = 0;
    while (i < array.length - chunkSize) {
      bottomUpMerge(array, i, chunkSize, workArray, compare);
      i += chunkSize * 2;
    }
    chunkSize *= 2;
  }
  return array;
}
function sort ( array , compare ) { var workArray = new Array ( array . length ) ; var chunkSize = 1 ; while ( chunkSize < array . length ) { var i = 0 ; while ( i < array . length - chunkSize ) { bottomUpMerge ( array , i , chunkSize , workArray , compare ) ; i += chunkSize * 2 ; } chunkSize *= 2 ; } return array ; }
Sorts an array using bottom up merge sort.
@param {Array} array The array to sort.
@param {function} compare The compare function.
@returns The sorted array.
Sorts an array using bottom up merge sort .