1procedure merge(h1, h2)
2 if h1 is null, return h2 (and vice versa)
3 ensure h1.key ≤ h2.key (swap if needed)
4 h1.right ← merge(h1.right, h2)
5 swap h1.left and h1.right (unconditional)
6 return h1
7procedure insert(heap, value)
8 return merge(heap, new node(value))
9procedure extractMin(heap)
10 min ← heap.key
11 return merge(heap.left, heap.right)