Merging two unsorted arrays in sorted order
Submissions: 2852   Accuracy:

41.67%

  Difficulty: Easy   Marks: 2

GIven two different arrays A and B your task is to merge the two arrays which are unsorted into another array which is sorted.

Input:

The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. The first line of each test case contains the integers N and M denoting the size of arrays A and B respectively.

The second line of each test case contains N space separated integers denoting elements of the array A[ ].

The third line of each test case contains M space separated integers denoting elements of the array B[ ].


Output:

Print the merged and sorted array with space between each element. Print the answer for each test case in a new line.


Constraints:

1<= T <=100

1<= N, M <=10000

0<= A[ ], B[ ] <=100000


Example:

Input:

1

3 3

10 5 15

20 3 2

Output:

2 3 5 10 15 20

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

Contributor: Sujnesh Mishra
Author: sujnesh


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.



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


to report an issue on this page.