Merge Two Sorted Arrays
PROSorting & SearchingMerge Algorithm
1D & 2D Arrays
Sorting
Write a program that inputs 3 integers into array `a`, then 3 integers into array `b`. Each array is already sorted in ascending order.
Merge them into a single array of 6 values that is also in ascending order, **without sorting the combined array**: repeatedly compare the next unused value of each array and copy the smaller one across. Output the merged array, one value per line.
For example, `a` = 1, 4, 7 and `b` = 2, 3, 9 produce 1, 2, 3, 4, 7, 9.
Example Input
1
4
7
2
3
9
Example Output
1
2
3
4
7
9
0% (0 passed / 0 attempted)