Given a binary tree, return true if it is BST, else false. For example, the following tree is not BST, because 11 is in left subtree of 10. The task is to complete the function isBST() which takes one argument, root of Binary Tree.
The struct Node has a data part which stores the data, pointer to left child and pointer to right child.
There are multiple test cases. For each test case, the function will be called individually.
The function should return 1 if BST else return 0.
Since this is a functional problem you don't have to worry about input, you just have to complete the function isBST().
1 <= T <= 30
1 <= Number of edges <= 100
1 <= Data of a node <= 1000
1 2 R 1 3 L
10 20 L 10 30 R 20 40 L 20 60 R
Testcases 1: The given binary tree is not BST, hence the answer is 0.