recursive function to find the Inorder Scuccessor when the right child of node x is None
def findInorderRecursive ( root , x ) : NEW_LINE INDENT if ( not root ) : NEW_LINE INDENT return None NEW_LINE DEDENT if ( root == x or ( findInorderRecursive ( root . left , x ) ) or ( findInorderRecursive ( root . right , x ) ) ) : NEW_LINE INDENT if findInorderRecursive ( root . right , x ) : NEW_LINE INDENT temp = findInorderRecursive ( root . right , x ) NEW_LINE DEDENT else : NEW_LINE INDENT temp = findInorderRecursive ( root . left , x ) NEW_LINE DEDENT if ( temp ) : NEW_LINE INDENT if ( root . left == temp ) : NEW_LINE INDENT print ( " Inorder ▁ Successor ▁ of " , x . data , end = " " ) NEW_LINE print ( " ▁ is " , root . data ) NEW_LINE return None NEW_LINE DEDENT DEDENT return root NEW_LINE DEDENT return None NEW_LINE DEDENT