Esri Interview Question: How to make vectors push_back... | Glassdoor

Interview Question

Software Development Engineer Interview Redlands, CA

How to make vectors push_back function as efficient as c

  arrays ? Why it is slow?

Interview Answer

1 Answer


It’s slow because the vector potentially has to reallocate more memory. You could use std::vector::reserve to allocate memory in advance. Source:

Ben on Aug 15, 2016

Add Answers or Comments

To comment on this, Sign In or Sign Up.