Given a Binary Tree, find maximum and minimum elements in it.
The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. Each test case contains an integer n denoting the number of edges. The following line contains the edges as shown in the example.
Print two space-separated integers maximum and minimum element in the binary tree.
1<=data of the node<=10^5
2 7 L 2 5 R 7 6 R 6 1 L 6 11 R 5 9 R 9 4 L
The above tree is constructed through the example in the input. The maximum and minimum element in this binary tree is 11 and 1 respectively.
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.