4.1 Remove node
Removing a node n in a binary tree result in three possible cases.
- n is a leaf. In this case, we can safely remove n, and update the parent’s link to it.
- n only has one child (left or right). In this case, we can move the child up to take the place of n.
- n has two children, r for the right child, and l for the left child. In this case, the logic of the removal depends
on the nature of the tree. In other words, there is no generic remove node method.