Something I frequently run into is the following: imagine that in your code you evaluate a list of data, but you initially do not know the amount of values. So when your preallocate your array, you cannot set the exact size. In some programming language that is not much of an issue, as arrays can be (efficiently) dynamically resized. However, in C++ for instance, resizing arrays at run-time is a don't (right?). For example, I'm working on a piece of code that gets the names of all the files in a certain folder. I want these names in a string array, but the amount of files is not known. I can come up with two solutions: 1) Run the code twice, the first time without saving the codes and just counting. 2) Create a ridiculously large array and save the names immediately. Afterwards, the array could be resized to remove the empty elements. Which method would be better, that is, more efficient? The first one seems pretty solid, considering that with method #2 you sill have the risk of overloading your array and you allocate unnecessary memory. Any ideas? Thanks in advance!