Write an algorithm to test whether a Binary Tree is a Binary Search Tree.
The algorithm to test whether a Binary tree is as Binary Search tree is as follows:
bstree(*tree)
{
while((tree->left !=null)&& (tree->right !=null))
{
if(tree->left < tree->root)
bstree(tree->left);
else
return(1);
if(tree->right > tree->root)
bstree(tree->right);
else
return(1);
}
return(0);
}