BETA

Difficulty Level: Medium

Submissions: 2469 Accuracy:

38.8%

Merge two BST 's (Function Problem)
       

Given two BST, Your task is to complete the function merge which  prints the elements of both BSTs in sorted form.

Input:
The first line of input contains an integer T denoting the no of test cases. Then T test cases follow. Each test case contains three lines. The first line of each test case contain's an integer N and M denoting the size of the two BST's. Then In the next two line are space separated values of the two BST's.

Output:
The function should print the elements of both BST's in sorted form.

Constraints:
1<=T<=100
1<=N,M<=100

Example(To be used only for expected output):
Input:

2
3 3
1 33 4 
6 7 1
2 2
1 6
9 2
Output:
1 1 4 6 7 33
1 2 6 9

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Harshit Sidhwa


					   
It is recommended to 'Compile & Test' your code before clicking 'Submit'!

Compilation/Execution Result:

Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.