3 ms·
I was curious enough to have a go at implementing the same algorithm using a single vector [0], but it still runs about twice as slow as the original. std::set
by codr7 3y ago
I was curious enough to have a go at implementing the same algorithm using a single vector [0], but it still runs about twice as slow as the original.
std::set is almost 4x faster on my machine.
A straight binary sorted vector is even faster. But degrades when the input is highly "unsorted" because of vector manipulations.
[0] doesn't show any sensitivity to insert order, which is a bit odd.
https://gist.github.com/codr7/d94ef02a5949cb01c57038c606838dc4 https://gist.github.com/codr7/d94ef02a5949cb01c57038c606838d...