check the validence of a BST