function pop(compare, heap) {
  var lastItem = heap.pop();

  if (heap.length !== 0) {
    var item = heap[0];
    heap[0] = lastItem;
    siftUp(compare, heap, 0);

    return item;
  }

  return lastItem;
}
Function used to pop an item from a heap represented by a raw array.

@param  {function} compare - Comparison function.
@param  {array}    heap    - Array storing the heap's data.
@return {any}