You are viewing a single comment's thread. Return to all comments →
Working C++
bool check(Node* root, int min, int max){ if(root == nullptr) 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(Node* root) { return check(root, -1, 100001); }
Seems like cookies are disabled on this browser, please enable them to open this website
Is This a Binary Search Tree?
You are viewing a single comment's thread. Return to all comments →
Working C++