How do you check if a Binary Tree is a Binary Search Tree?
Utilisateur anonyme
boolean isBST(Node root, int min, int max) { if (root == NULL) return true; if (root.value max) return false; return isBST(root.left, min, root.value) && isBST(root.right, root.key, max); } /* first call would be isBST(root,INT_MIN,INT_MAX); */