Driver Code
if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT root1 = getnode ( 50 ) NEW_LINE root1 . left = getnode ( 20 ) NEW_LINE root1 . right = getnode ( 60 ) NEW_LINE root1 . left . left = getnode ( 10 ) NEW_LINE root1 . left . right = getnode ( 30 ) NEW_LINE root1 . right . left = getnode ( 55 ) NEW_LINE root1 . right . right = getnode ( 70 ) NEW_LINE p = [ None ] NEW_LINE q = [ None ] NEW_LINE find_p_s ( root1 , 55 , p , q ) NEW_LINE if ( p [ 0 ] ) : NEW_LINE INDENT print ( p [ 0 ] . data , end = " " ) NEW_LINE DEDENT if ( q [ 0 ] ) : NEW_LINE INDENT print ( " " , q [ 0 ] . data ) NEW_LINE DEDENT DEDENT