Professional Documents
Culture Documents
int key;
Node* left;
Node* right;
};
struct BST{
Node *root;
};
Node* createBST(){
BST* bst = new BST;
bst->root = NULL;
}
int value = 0;
int value = 0;
if (leftMax > rightMax)
value = leftMax;
else
value = rightMax;
if (node->left != NULL
&& maxValue(node->left) >= node->key)
return false;
if (node->right != NULL
&& minValue(node->right) <= node->key)
return false;
if (!isValidBST(node->left) || !isValidBST(node->right))
return false;
return true;
}