File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change 11# ` StandardTemplateLibrary `
22
3+ ## Data Structures
4+
5+ | Container | Implementation | Lookup | Insertion | Deletion |
6+ | -----------------------------| --------------------------------------------| --------------| ----------------| --------------|
7+ | ` std::list ` | Doubly linked list | O(n) | O(1) (with iterator) | O(1) (with iterator) |
8+ | ` std::forward_list ` | Singly linked list | O(n) | O(1) (after node) | O(1) (after node) |
9+ | ` std::vector ` | Dynamic array (contiguous) | O(1) (random access) / O(n) (search) | O(1) amortized at end / O(n) elsewhere | O(n) |
10+ | ` std::deque ` | Double-ended queue (blocks) | O(1) (random access) | O(1) at front/back | O(1) at front/back |
11+ | ` std::set ` , ` std::map ` | Balanced binary tree (Red-Black tree) | O(log n) | O(log n) | O(log n) |
12+ | ` std::unordered_set ` , ` std::unordered_map ` | Hash table | O(1) average / O(n) worst | O(1) avg / O(n) worst | O(1) avg / O(n) worst |
13+ | ` std::multiset ` , ` std::multimap ` | Balanced binary tree (Red-Black tree) | O(log n) | O(log n) | O(log n) |
14+ | ` std::unordered_multiset ` , ` std::unordered_multimap ` | Hash table | O(1) average / O(n) worst | O(1) avg / O(n) worst | O(1) avg / O(n) worst |
15+
316## ** Quick Algorithm Lookup Table**
417
518| What You Want to Know | On a Unsorted Range | On a Sorted Range | With a set or map | With a multiset or multimap |
You can’t perform that action at this time.
0 commit comments