How would you check a BST?
Anonymous
Looks like the prev solution needs a correction. Something like this? public boolean checkBst(Node n) { if (n == null) return true; if (checkBst(n.left)) { if ( checkBst(n.right)) { boolean isBst = 1; if (n.left != null){ isBst *= n.left.data n.data; } return isBst; } } return false; }
Check out your Company Bowl for anonymous work chats.