Untitled
unknown
plain_text
a year ago
417 B
2
Indexable
Never
bool isbst(BinaryTreeNode<int>* root,int min,int max){ if (root==NULL) return true; if(root->data >min && root->data <max){ //if in tree bool l=isbst(root->left,min,root->data); bool r=isbst(root->right,root->data,max); return( l&&r); }else{ return false; } } bool validateBST(BinaryTreeNode<int>* root) { return isbst(root,INT_MIN,INT_MAX); }