Function to check whether a binary tree is binary search tree or not working
<p>Can someone tell me why is this not working?
This seems correct to me</p>

<p>please someone look into this.</p>

<p>I am not able to find my mistake.</p>

<pre><code>bool checkbst(node* root,int minValue,int maxValue)
{
   if(root==NULL)
   {

       return true;
   }
   else if(((root-&gt;data)&gt;(minValue))&amp;&amp;
           ((root-&gt;data)&gt;(maxValue))&amp;&amp;
           (checkbst(root-&gt;left,minValue,root-&gt;data))&amp;&amp;
           (checkbst(root-&gt;right,root-&gt;data,maxValue)))
   {

       return true;
   }
   else
   {

     return false;
   }
}

void isbst(node* root)
{
   if( checkbst(root,INT_MIN,INT_MAX))
   {
       cout&lt;&lt;"the tree is bst";
   }
}
</code></pre>