CPP Data Structures Time Complexity
CPP Data Structures Time Complexity
List (`std::list`) insert(iterator, val) Insert element before specified position O(1)
Multimap (`std::multimap`) insert({key, value}) Inserts key-value pair (allows duplicate keys, sorted)O(log
Multimap (`std::multimap`) find(key) Searches for an element with the given key O(log
Unordered Map (`std::unordered_map`)insert({key, value}) Inserts key-value pair (unique, unordered) O(1) a
Unordered Map (`std::unordered_map`)find(key) Searches for an element with the given key O(1) a
Priority Queue (`std::priority_queue`) push(value) Inserts element into the priority queue O(log
Priority Queue (`std::priority_queue`) pop() Removes the element with the highest priority O(log
Priority Queue (`std::priority_queue`) top() Accesses the element with the highest priority O(1)