Allows only distinct valued nodes
if ( prev != null && root . data <= prev . data ) return false ; prev = root ; return isBSTUtil ( root . right ) ; } return true ; } static Boolean isBST ( Node root ) { return isBSTUtil ( root ) ; }