Check whether the tree is a BST or not