Sometimes pushing into a vector is O(n), but typically not. So it’s the penalty of allocating new data memory when the underlying array needs a resize that’s amortized for multiple push calls. Similarly with a typical…
Sometimes pushing into a vector is O(n), but typically not. So it’s the penalty of allocating new data memory when the underlying array needs a resize that’s amortized for multiple push calls. Similarly with a typical…