Check if a binary tree is a BST. Before compiling.