I am not very well versed in the cost of the algorithm, so here I ask.
Here is a vector initialized with 1000 elements:
vector<unsigned int> mFreeIndexes(1000);
I will constantly add pop_back / push_back elements to the vector, but never push_back more than 1000 (so never force the vector to redistribute).
In this case, the pop_back / push_back operations will be O (1) or O (n)?
source
share