You are viewing a single comment's thread. Return to all comments →
def inorder(root,lst): if root: inorder(root.left,lst) lst.append(root.data) inorder(root.right,lst) else: return def check_binary_search_tree_(root): lst = [] inorder(root,lst) prev = -1000 for x in lst: print(x) if prev>=x: return "No" prev = x return "Yes"
Seems like cookies are disabled on this browser, please enable them to open this website
Is This a Binary Search Tree?
You are viewing a single comment's thread. Return to all comments →