You are viewing a single comment's thread. Return to all comments →
i have written almost same code as
bool check(Node * node, const size_t& min, const size_t& max) { if(node) { if(!((node->data > min) && (node->data < max))) { return false; } else { return (check(node->left, min, node->data) && check(node->right, node->data, max)); } } return true; } bool checkBST(Node* root) { if(root) { return (check(root->left, 0, root->data) && check(root->right, root->data, -1)); } else { return true; } }
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 →
i have written almost same code as