check if a binary tree is a binary search tree I have some doubts about this algorithm which checks if a binary tree is a binary search tree:    

isAbr(x)
    {
            if(x == NULL)
                    return &lt;true, -∞, +∞&gt;;
            if(x.left == NULL &amp;&amp; x.right == NULL)
                    return &lt;true, x.key, x.key&gt;;

            &lt;abrLeft, minLeft, maxLeft&gt; = isAbr(x.left);
            &lt;abrRight, minRight, maxRight&gt; = isAbr(x.left);
            abr = abrLeft &amp;&amp; abrRigh &amp;&amp; (x.key &gt; maxLeft) &amp;&amp; (x.key &lt; minLeft);
            min = MIN(minLeft, minRight, x.k);
            max = max(maxLeft, maxRight, x.k);

            return &lt;abr, min, max&gt;
    }


in particular, it is not clear to me what happens when a node has only one child:



for example, here, the node with the value 6 returns $&lt;true, 6, 6&gt;$, and the NULL node to the right of the root returns $&lt;true, -∞, + ∞&gt;$; but with the instruction abr = abrLeft &amp;&amp; abrRigh &amp;&amp; (x.key &gt; maxLeft) &amp;&amp; (x.key &lt; minLeft);
don't we get FALSE $(8 &lt; -∞)$?
abr = abrLeft &amp;&amp; abrRigh &amp;&amp; (x.key &gt; maxLeft) &amp;&amp; (x.key &lt; minLeft); should likely be comparing with maxLeft and minRight, not maxLeft and minLeft



if(x == NULL)
    return &lt;true, -∞, +∞&gt;;


I'm guessing the point of returning infinities here is to make a NULL vertex NEVER fail the &gt; and &lt; comparisons above, in which case in makes more sense to return &lt;true, +∞, -∞&gt;;