Assuming that the two input arrays are already sorted, iterate over the elements in both the arrays and insert them into the third array in ascending order. Keep in mind that the size of the third array will be equal to the sum of the sizes of the input arrays.
Merging two sorted arrays A and B creates a third array C that contains all the elements of A and B, arranged in ascending order. To successfully implement this algorithm : 1. Create a third return array which has a size equal to the sum of the sizes of the input arrays. 2. You could use three while loops, since the lengths of the two arrays may not be the same. 3. Traverse through both the input arrays and pick the elements in increasing order and add them to the third sorted array.
4. Since the array sizes may not be the same, use the other two loops to account for any remaining elements in the input arrays.