STL vector with reverse and pop/push_back cost

Viewed 1208

I am not exactly good to come up with algorithm costs, so here I am asking.

Here is a vector initially initialized with 1000 elements:

vector<unsigned int> mFreeIndexes(1000);

I will continuously pop_back/push_back elements to the vector, but never push_back over 1000 (so never force vector to reallocate).

In this case will the pop_back/push_back operations be O(1) or O(n)?

1 Answers
Related