check if a BT is BST
Anonymous
// Check if a BT is BST bool IsBST(TreeNode* const root) { if (!root) return true; bool ell = (root->left ? root->left->data data : true); bool are = (root->right ? root->right->data >= root->data : true); return ell && are && IsBST(root->left) && IsBST(root->right); }
Check out your Company Bowl for anonymous work chats.