4 ms·
Interesting, but not unexpected, the memory locality of the vector dominates otherwise similar algorithms. One remark. In the unordered_set case, it would be f
by greg7mdp 10y ago
Interesting, but not unexpected, the memory locality of the vector dominates otherwise similar algorithms.
One remark. In the unordered_set case, it would be faster to assign rather than inserting the first set, because with insert() we loose the fact that the elements in A are already unique and out will not be resized appropriately.
out = A;
out.insert(B.begin(), B.end());