Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. boolean checkBST(Node root) {
  2. if(root == null){
  3. return true;
  4. }if((root.left != null && root.data < root.left.data )){
  5. return false;
  6. }
  7. else if((root.right != null && root.data > root.right.data )){
  8. return false;
  9. }
  10. else{
  11. return checkBST(root.left) && checkBST(root.right);
  12. }
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement