| # | Problem | Pass Rate (passed user / total user) |
|---|---|---|
| 13084 | Merge Two Arrays |
|
| 13085 | Merge Sort |
|
Description
Given two sorted arrays, implement the function merge(). Note that the two arrays are assumed to be next to each other (with contagious memory locations), and the first array is ahead of the second. You should replace the original two arrays by the result.
Input
The first line consists of two integers, one is the size of the first array and the other is the size of the second array.
The second line consists both elements in the first array and the second array (no newline).
Both arrays should be in increasing order.
Output
The first line is the size of the merged array.
The second line is the elements of the merged array.
There should be a newline at the end of the ouput!
Sample Input Download
Sample Output Download
Partial Judge Code
13084.cPartial Judge Header
13084.hTags
Discuss
Description
Given an unsorted array. Implement the recursive MergeSort function. In the MergeSort(), you need to call the merge() function implemented in 13084 - Merge Two Arrays.
Input
The first line consists of the size of the array that needs to be sorted.
The second line consists of the elements of unsorted arrray.
Output
The first line consists of the elements of sorted array.