check if tree is BST