You are viewing a single comment's thread. Return to all comments →
You want this...
static int min = -1; static boolean flag = true; public static void inOrder(Node root){ if(root.left != null){ inOrder(root.left); } if(root.data <= min){ flag = false; } min = root.data; if(root.right != null){ inOrder(root.right); } } boolean checkBST(Node root) { inOrder(root); return flag; }
Seems like cookies are disabled on this browser, please enable them to open this website
Is This a Binary Search Tree?
You are viewing a single comment's thread. Return to all comments →
You want this...