Delete(T,x) ; Returns deleted node if left(x) = NIL or right(x) = NIL then d = x ; Case I and II else d = Successor(x) ; Case III if left(d) <> NIL ; Get child of node to be removed then c = left(d) else c = right(d) if c <> NIL then Parent(c) = Parent(d) ; Remove node d if Parent(d) = NIL then root(T) = c else if d = left(parent(d)) then left(parent(d)) = c else right(parent(d)) = c if d <> x ; Case III then key(x) = key(d) return(d)
BST Insertion Example
BST Example