right, using `std::binary_search()` should be better because the vector is sorted. BTW if you want an algorithm with O(n), I suggest you to use bit arrays having a size of the number of all elements. Using the bits, you can calculate `updateUnion()` and `excludeElements()` with O(n). Disadvantage is you need more memory.