Please refer below post for details of this function . www . geeksforgeeks . org / a - program - to - check - if - a - binary - tree - is - bst - or - not / https :
def isBST ( root , min , max ) : NEW_LINE INDENT if ( root == None ) : NEW_LINE INDENT return True NEW_LINE DEDENT if ( root . key < min or root . key > max ) : NEW_LINE INDENT return False NEW_LINE DEDENT DEDENT