[Solved] Reasons for preferring unorder_set to a vector
You can store non-copyable, non-movable objects in an unordered_set. Finding whether a given element is in the set is O(1) instead of O(n), or O(log n) if you keep the vector sorted (which is itself O(n) on insertion). unordered_set disallows duplicates. Removing a given element is O(1). In the case of a sorted vector, it’s … Read more