Check whether a tree is a BST or not