Yes it is O(n) for a dynamic array if we consider insertion at the end.This is so because ,
If we started out with a dynamic array of size 4, it would take constant time to push four elements onto it. Yet pushing a fifth element onto that array would take longer as the array would have to create a new array of double the current size (8), copy the old elements onto the new array, and then add the new element. The next four push operations would similarly take constant time, and then the subsequent addition would require another slow doubling of the array size.
In general if we consider an arbitrary number of pushes n to an array of size n, we notice that push operations take constant time except for the last one which takes O(n) time to perform the size doubling operation.
But if we want to find average case complexity , we see here that we have n operations total we can take the average of this and find that for pushing elements onto the dynamic array takes O(n/n) = O(1) i.e. constant time.
Similarly , for deletion at the end , amortized complexity = O(1) time . Just follow the reverse of what we have done for insertion at end for dynamic array.