Given a BST and some keys, you need to insert the keys in the given BST. Duplicates are not inserted (If a test case contains duplicate keys, you need to consider first occurrence and ignore duplicates).
The first line of the input contains an integer 'T' denoting the number of test cases. Then 'T' test cases follow. Each test case consists of three lines. Description of test cases is as follows:
The First line of each test case contains an integer 'N' which denotes the no of nodes to be inserted in the BST. .
The Second line of each test case contains 'N' space separated values of the nodes to be inserted in the BST.
For each testcase, in a new line, the inorder of the BST gets printed.
Since this is a function problem, you don't have to read anything. You have to complete the function insert that takes node and key as parameter.
1 <= T <= 100
1 <= N <= 100
2 81 87 42 66 90 45
6 7 9 8
1 1 2 1
2 42 45 66 81 87 90
6 7 8 9
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.