Vector stl 8 doubt

A student just learned about vectors. Now he wants to implement a class vector which can support dynamic array of integers.

He writes the following code :

class myVector
{
int * data; // pointer to underlying array to store elements
int capacity; //size of the underlying array
int elementsInVec; //number of elements currently in the vector
public:
myVector(){
data = new int[1000];
elementsInVec = 0, capacity = 1000;
}
void push_back(int x)
{
if( elementsInVec == capacity)
{
int * temp = new int[capacity + 1];
for(int i = 0; i < capacity; i++)
temp[i] = data[i];
temp[capacity++] = x;
delete data;
data = temp;
}
else data[elementsInVec] = x;
elementsInVec++;
}

    // more code
}

What is the time complexity of push_back as implemented by the student? Let N be the current size of the vector.

O(1) on average

O(N) per call to push_back().

O(1) for the 1st 1000 calls to push_back and O(N) for every call after that.

O(logN) on average.

the answer is
O(1) for the 1st 1000 calls to push_back and O(N) for every call after that.
why?
for the first 1000 elements what it simply does is push back in the original vector i.e. execution of this else block
else data[elementsInVec] = x;

which is simply pushing in the vector hence O(1)
but once 1000 elements are pushed the if block gets executed, in the if block
int * temp = new int[capacity + 1];
for(int i = 0; i < capacity; i++)
temp[i] = data[i];
these three lines create a new vector of the new capacity 1000+ no of extra elements and copies all the previous elements into the new vector, this operation takes O(n) time

@Ankit_kumar_3003 hey, if your doubt is solved
please mark it as resolved