


• The left subtree of a node contains only nodes with data less than the node’s data.
• The right subtree of a node contains only nodes with data greater than the node’s data.
• Both the left and right subtrees must also be binary search trees.
For the given level order traversal: 5 3 6 2 4 7
The BST will be:

The Inorder Traversal of this BST is 2 3 4 5 6 7.
The first line contains an integer ‘T’ denoting the number of test cases. Then each test case follows.
The first line of each test case contains a single integer ‘N’ denoting the length of the array.
The second line of each test case contains ‘N’ single space-separated integers denoting the elements of the array.
For each test case, print the inorder traversal of the BST.
The inorder traversal of a binary tree is the traversal method in which for any node its left subtree is visited first, then the node itself, and then the right subtree.
Print the output of each test case in a separate line.
You do not need to print anything. It has already been taken care of. Just implement the given function.
1 <= T <= 10
1 <= N <= 10^5
0 <= levelOrder[i] <= 10^5
Time Limit: 1 sec
The basic idea is that for every number we will find its position in BST using recursion.
Algorithm
We will create a class ‘NodeRange’ that has:
Algorithm