Driver progam to test above function
root = None NEW_LINE root = insert ( root , 20 ) NEW_LINE root = insert ( root , 8 ) ; NEW_LINE root = insert ( root , 22 ) ; NEW_LINE root = insert ( root , 4 ) ; NEW_LINE root = insert ( root , 12 ) ; NEW_LINE root = insert ( root , 10 ) ; NEW_LINE root = insert ( root , 14 ) ; NEW_LINE temp = root . left . right . right NEW_LINE succ = inOrderSuccessor ( root , temp ) NEW_LINE if succ is not None : NEW_LINE INDENT print " \n Inorder ▁ Successor ▁ of ▁ % ▁ d ▁ is ▁ % ▁ d ▁ " % ( temp . data , succ . data ) NEW_LINE DEDENT else : NEW_LINE INDENT print " \n Inorder ▁ Successor ▁ doesn ' t ▁ exist " NEW_LINE DEDENT