Bubble UP (newchild) (1) if (!isroot(newchild)) (2) if newchild &k newchild.parent() (3) swap newchild.parent, newchild (4) bubbleup(newchild)
Bubble Down(node) (1) if !isleaf(node) (2) if node.rightChild.isExternal() (3) s = rightchild (4) else (5) s = min(leftchild.element,rightchild.element) (6) if s.element < node.element (7) swap(node,s) (8) BubbleDown(node)