Union(H1, H2) H = new heap containing trees of H1 and H2 merged in non-decreasing order by degree of root ; Similar to Merge used in MergeSort ; O(lg n): at most two roots of each degree, ; O(lg n) possible degrees ; No more than 2 Bi trees in H at this point ; Could be 3 after linking two Bi-1 trees together prev-x = NIL ; three-tree window x = head(H) ; look for:
next-x = sibling(x) while next-x NIL if degree(x) degree(next-x) or degree(x) = degree(next-x) = degree(sibling(next-x)) then move window right by one else if key(x) key(next-x) then:
else:
advance window
Running time = O(lg n) if n = n1 + n2 nodes in H.