Tag: data structures
3 posts
-
Python list vs tuple vs set: Mutability, Duplicates, Big-O and Memory
Compare Python list, tuple, and set: ordering, duplicates, big-O operations, memory, and a decision flowchart for real code.
-
C++ map vs unordered_map: Complexity, Pitfalls, and When to Use Each
map vs unordered_map: sorted red-black tree vs hash table. Complexity, range queries, the operator[] insertion pitfall, erasing while iterating, iterator invalidation, and custom key hashing.
-
C++ Heap Algorithms: make_heap, push_heap, pop_heap
How make_heap, push_heap, pop_heap and sort_heap keep a heap inside a vector, when priority_queue is simpler, and how comparators build a min-heap.