wrong answer in one testcase
Arrays median of sorted arrays
You are using a wrong approach for merging the array,
For eg : 5
1 4 5 6 10
2 3 7 8 9
Array after sorting using your code is :
1 2 3 4 5 7 6 8 9 10
But array should be : 1 2 3 4 5 6 7 8 9 10
Median produced by your code is : 6
But median should be : 5
can you suggest a better approach?
Create an array arr3[] of size n1 + n2.
Simultaneously traverse arr1[] and arr2[].
Pick smaller of current elements in arr1[] and arr2[], copy this smaller element to next position in arr3[] and move ahead in arr3[] and the array whose element is picked.
If there are are remaining elements in arr1[] or arr2[], copy them also in arr3[].
hint: use the merge function of merge sort