bool check(NodeBin root, int min, int max) { if (root == null) { return(true); } if (root.data <= min || root.data >= max) { return(false); } return(check(root.left, min, root.data) && check(root.right, root.data, max)); }
bool checkBst(NodeBin root) { return(check(root, int.MinValue, int.MaxValue)); }