I have written the following code to check if a tree is a Binary search tree. Please help me check the code:
Okay! The code is edited now. This simple solution was sugge
boolean bst = isBST(root, Integer.MIN_VALUE, Integer.MAX_VALUE); public boolean isBST(Node root, int min, int max) { if(root == null) return true; return (root.data > min && root.data < max && isBST(root.left, min, root.data) && isBST(root.right, root.data, max)); }