Inorder successor OR Predecessor of BST node
It is important to understand inorder successor of BST because it helps us understand deletion of node from a tree, when the node deleted has 2 children.
To find the inorder successor of node u:
If u has a right child, r, then succ(u) is the leftmost descendent of r
Otherwise, succ(u) is the closest ancestor, v, of u (if any) such that u is descended from the left child of v.
[Read More]