Jun 25, 2009

Determine a bt is a bst

Determine a bt is a bst
bool foo(tree* root, int max, int min)
{
if(!root) return true;

if(root->valval>max)
return false;
return foo(root->left,root->val,min)&&foo(root->right,max,root->val);
}

No comments:

Post a Comment