The elements of the two arrays are taken as the input. Then the **two arrays are merged together and stored in the third array**.

```
INPUT: Array elements
OUTPUT: the new array after merging
PROCESS:
Step 1: [taking the input]
Read m [number of elements of the 1st array]
For i=0 to m-1 repeat
Read a[i]
[end of ‘for’ loop]
Read n [number of elements of the 2nd array]
For i=0 to n-1 repeat
Read b[i]
[End of ‘for’ loop]
Step 2: [merging the two arrays]
For i=0 to m-1 repeat
Set c[i]<-a[i]
[End of ‘for’ loop]
Set j<-i
For i=0 to n-1 repeat
Set c[j]<-b[i]
Set j<-j+1
[End of ‘for’ loop]
[printing the merged array]
For i=0 to m+n-1 repeat
Print c[i]
[End of ‘for’ loop]
Step 3: Stop
```

The **time complexity to take the number of elements** is **O(n)** and the** time complexity to merge is O(m + n)** where **m** and **n** the **number of elements of the two arrays respectively**.

Related

- Find Maximum and Minimum from an array
- Kth Largest and Smallest Element
- 2nd largest element from the array
- Find how many negative numbers are present in the array
- The elements of the one array are copied to another array.
- Delete element from any position in array
- Frequency of each element in the Array
- Find out the unique elements from the Array
- Finds odd and even elements from the array and stored in two separate arrays
- Counts the number of odd and even elements separately from the array
- Reverses the elements of an Array
- Rotated the Array at left
- Rotated the Array right
- Sorted the array and then separate even and odd elements in different array
- Sort number of strings in an array
- Check one given element of an array present more than n/2 times or not.
- Sum of the elements of an Array is calculated using a pointer
- The union and intersection between the two given arrays