|@Rahul Jadhav 1||466|
Given two binary max heaps as arrays, merge the given heaps, after merging the two arrays.
The task is very simple to merge the two arrays firstly keep all the elements of first array than elements second array, than apply the merge operation of heaps.
First line consists of T test cases. First line of every test case consists of 2 integers N and M, denoting the number elements of two arrays (MAX HEAP). Second and third line of every test cases consists of elements of 2 Heaps respectively.
Single line output, print the merged max heap.
10 5 6 2
12 7 9
12 10 9 2 5 7 6
We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?Yes