Why I don't trust big O notation


Obviously, O(n) should be faster than O(nlogn), but it’s not!

It may be the case that the constant factor of Algorithm 2 is bigger than the constant factor of Algorithm 3. If the test cases were very large, then Algorithm 2 would be faster than Algorithm 3.

unordered_set is slow. avoid it if possible.

Technically on average it is O(1), faster than the O(log(n)) for set.

yeah