You are viewing a single comment's thread. Return to all comments →
THIS IS MY SOLUTION
int recent ;
boolean checkBST(Node root) { if(root == null) return true ;
boolean flag = checkBST(root.left) ; if(flag) { if(recent >= root.data) return false ; else recent = root.data ; } if(flag) flag = checkBST(root.right) ; return flag ;
}
Is This a Binary Search Tree?
You are viewing a single comment's thread. Return to all comments →
THIS IS MY SOLUTION
int recent ;
boolean checkBST(Node root) { if(root == null) return true ;
}