Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- boolean checkBST(Node root) {
- if(root == null){
- return true;
- }if((root.left != null && root.data < root.left.data )){
- return false;
- }
- else if((root.right != null && root.data > root.right.data )){
- return false;
- }
- else{
- return checkBST(root.left) && checkBST(root.right);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement