Given an array of size N which represents the elements to be inserted into BST (considering first element as root). The task is to find the minimum element in this given BST. If the tree is empty, there is no minimum elemnt, so print -1 in that case.
The input line contains T, denoting the number of testcases. Each testcase contains two lines. The first line contains N (number of nodes in BST). The second line contains N nodes of the BST separated by space.
For each testcase in new line, print the minimum element in BST.
The task is to complete the function minValue() which takes root as the argument and returns the minimum element of BST.
1 <= T <= 100
1 <= N <= 100
5 4 3 6 7 1
9 10 11
Testcase 1: The minimum value in the given BST is 1.
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.