check if a tree is a binary search tree
- by TimeToCodeTheRoad
I have written the following code to check if a tree is a Binary search tree. Please help me check the code:
Pair p{
boolean isTrue;
int min;
int max;
}
public boo lean isBst(BNode v){
return isBST1(v).isTrue;
}
public Pair isBST1(BNode v){
if(v==null)
return new Pair(true, INTEGER.MIN,INTEGER.MAX);
…