Sobes.tech
Middle

When does the worst-case search in unordered_set occur?

sobes.tech AI

Answer from AI

When all elements are hashed into the same bucket. This occurs either due to a poor hash function or collisions for the data. In such cases, search degrades to linear, O(n), where n is the number of elements in that bucket.