You are viewing a single comment's thread. Return to all comments →
One more version in Python:
def check(root, min_, max_): return (root is None or (root.data < max_ and root.data > min_ and check(root.left, min_, root.data) and check(root.right, root.data, max_))) def check_binary_search_tree_(root): return check(root, -float('inf'), float('inf'))
Seems like cookies are disabled on this browser, please enable them to open this website
Trees: Is This a Binary Search Tree?
You are viewing a single comment's thread. Return to all comments →
One more version in Python: