Reputation: 1199
What is the time complexity of Set.indexOf
? The documentation doesn't say, and the source delegates to some kind of internal storage class (_VariantStorage
/_VariantSetStorage
) whose source I can't find.
Upvotes: 2
Views: 1788
Reputation: 13316
The documentation for CollectionType
suggests that it is O(self.count).
That would make sense, as the worst case scenario is that every element in the Set
(or any other collection) is checked for equality. It shouldn't ever be more complex than O(self.count).
Upvotes: 4