As the code above reveals, insertion into a BST always occurs at a previously null link.
Deletion from a BST is more complicated. For example, what should happen if the data at the root is deleted?
Deletion is handled by considering three essential cases:
1. The BST is empty.
- Easy. Do nothing.
2. The data in Node t to be deleted has a null child (so 1 or 0 children)
- Make the parent of t point to t's other child
3. The data in Node t to be deleted has two children.
- Find t's successor Node s (use private s min(t.right) )
- Delete Node s from the subtree t.right (s has at most one child)
- Replace t with s by setting s.right to the modified right
subtree of t and setting s.left to t's left subtree.