Deleting from a binary search tree

Removing a leaf or a node with one child only reconnects its parent, but a node with two children takes the key of its successor, the smallest key in its right subtree, which has no left child and so comes out easily.

From Data Structures and Algorithms.