Write a function to check if a given tree is a valid binary search tree or not.
Utilisateur anonyme
Sorry! Since max and min do not check for NULL, must make adjustment: bool checkTree(Node* root) { if(root==NULL) return true; if(root->left==NULL?true:root->data>maxInTree(root->left)) { if(root->right==NULL?true:root->data right)) { if(root->left==NULL?true:checkTree(root->left)) { return (root->right==NULL?true:checkTree(root->right)); } } } return false; }