lib/heapify.js
function heapify(compare, x) {

  var n = x.length;

  for (var k = n / 2 | 0; k;) {

    (0, _core.siftdown)(compare, x, 0, n, --k);
  }

  return new _core.Heap(compare, x);
}
function heapify(compare, x) {

  var n = x.length;

  for (var k = n / 2 | 0; k;) {

    (0, _core.siftdown)(compare, x, 0, n, --k);
  }

  return new _core.Heap(compare, x);
}
Builds a heap in O(n) operations.

@param {function} compare the comparison function
@param {array} x the array where the heap is stored