Check if a tree is a BST