You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I recently discovered that std::collections::HashMap iterator iterates over all items in map for O(capacity), not O(length).
Indexmap probably can have iteration for O(length) using index based access. What is current complexity?
The text was updated successfully, but these errors were encountered:
The map iterators are based on the underlying vector of items, and that's contiguous, no deletion tombstones or anything like that. So yes, they should all be O(length).
That's also true for the simple set iterators. The multi-set ones like difference or union do add hash lookups, but that's still O(1) average, so I guess the same complexity overall.
I recently discovered that
std::collections::HashMap
iterator iterates over all items in map for O(capacity), not O(length).Indexmap probably can have iteration for O(length) using index based access. What is current complexity?
The text was updated successfully, but these errors were encountered: