0000
The elements of the array are taken as input. The elements of the main array are copied to another array.
INPUT: Array elements
OUTPUT: the new array after copying
PROCESS:
Step 1: [taking the input]
Read n [number of elements]
For i=0 to n-1 repeat
Read a[i]
[end of ‘for’ loop]
Step 2: [copying the elements of one array into another]
For i=0 to n-1 repeat
Set b[i]<-a[i]
[End of ‘for’ loop]
Step 3: [printing the elements of the copied array]
For i=0 to n-1 repeat
Print b[i]
[End of ‘for’ loop]
Step 4: Stop.
The time complexity to take the number of elements is O(n) and the time complexity to copy the elements is also O(n).
Therefore, the time complexity of this program is O(n).