I decided too quickly. I looked for more info on binary_search and it works only in sorted array. It worked in my case while the array was not sorted, but it's not stable solution.
Since sorting...
Type: Posts; User: petry
I decided too quickly. I looked for more info on binary_search and it works only in sorted array. It worked in my case while the array was not sorted, but it's not stable solution.
Since sorting...
I only need to check if an element exists no need to keep the order. I made a new test including set and Daved's suggestion, the results are below:
Filesize: 14mb
Lines: 1.050.000
Average line...
I only to search through the elements, no need to access by key.
I have just tested the difference.
Filesize: 8mb
Lines: 700.000
Average line length: 15 characters
Time to fill:
vector: 3843ms
string: 3891ms
Hi All:
I have a large number of elements to be stored into vector or basic string(delimited by \n). I need to search for an element and I would like to know what is faster:
A:
std::string...