You are viewing a single comment's thread. Return to all comments →
I did an inorder traversal and check for increasing order. CODE:
vector<int> a; void in(Node* root) { if(root) { in(root->left); a.push_back(root->data); in(root->right); } } bool checkBST(Node* root) { in(root); for(int i = 0;i<a.size()-1;i++){ if(a[i]>=a[i+1]) return false; } return true; }
Seems like cookies are disabled on this browser, please enable them to open this website
Trees: Is This a Binary Search Tree?
You are viewing a single comment's thread. Return to all comments →
I did an inorder traversal and check for increasing order. CODE: