Question: JAVA!!!! The following code should check if a given binary tree is a BST. However, for some trees, it returns the wrong answer. public static
JAVA!!!!


The following code should check if a given binary tree is a BST. However, for some trees, it returns the wrong answer. public static boolean brokenlsBST(TreeNode T) \{ if (T== null ) \{ return true; \} else if (T.left != null \&\& T.left.val > T.val T.right != null \&\& T.right.val
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
