code: function mergeHeaps(a, b) {
    if (typeof a.head === 'undefined') {
      return b.head;
    }
    if (typeof b.head === 'undefined') {
      return a.head;
    }
  
    var head;
    var aNext = a.head;
    var bNext = b.head;
  
    if (a.head.degree <= b.head.degree) {
      head = a.head;
      aNext = aNext.sibling;
    } else {
      head = b.head;
      bNext = bNext.sibling;
    }
  
    var tail = head;
  
    while (aNext && bNext) {
      if (aNext.degree <= bNext.degree) {
        tail.sibling = aNext;
        aNext = aNext.sibling;
      } else {
        tail.sibling = bNext;
        bNext = bNext.sibling;
      }
  
      tail = tail.sibling;
    }
  
    tail.sibling = aNext ? aNext : bNext;
  
    return head;
  }
docs: Merges two heaps together.
  
  @private
  @param {Node} a The head of the first heap to merge.
  @param {Node} b The head of the second heap to merge.
  @return {Node} The head of the merged heap.