I have a program where I tried the vector structure to store number. A small vector is declared filled and then push_back is used to store numbers as they pop up. However, this is quite slow. I java, which is my first language, I use lists or arrays to do this, but in c++ I'm not sure of how to choose, performance wise.
The program stores between 0 to 10000 integers. So should I go with a list or an array.
Just add a node when a number pops up.Code:List node | node data | data
Redeclare if array is full and copy the old, then insert new numbers.Code:Array[1000] = {data, data, etc...}
I usually lean against list as I think it's easier, no tinkering with arrays that's to small. But when I read papers on the subject it seems many c++ coders are using vectors and arrays to do this kind of stuff. Is there a reason for this, speed wise, or have I just stumbled upon gnarly papers..?