Populate In-Order successor in each
means next element obtained when we traverse.
if we keep a pointer to previously visited node, then current node is
every node has an element called successor, the code is as follows:
is a global variable here.
Can be made a function
argument if desired.
to populate any successor, we can just traverse the tree, keep a
previous pointer and set that previous’ successor to the
approach to do the same is to traverse in reverse order and set
current’s successor as previous.