According to me perform inorder traversal and at every point store the
current element in a temporary variable and check if the next element
obtained is greater than temp otherwise return false
int temp=-9999;
int flag=1;
void isBst(NODE *tree)
{
if (tree!=NULL)
{
isBst(tree->left);
if (temp<tree->info)
temp=tree->info;
else
{
flag=0;
return;
}
isBst(tree->right);
}
}
Please correct me if I'm wrong
On Fri, Jul 2, 2010 at 6:43 PM, sharad kumar <[email protected]>wrote:
> i read that link ,i dont think that is very efficient,someone plzzz look at
> that soln n comment
> bcoz i m really confused in this isbst ques so plzzz
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<algogeeks%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.