Tag: Data Structures
-
list.append vs Comprehension vs deque: 100k Benchmark
Benchmark reveals why list comprehensions beat append() by 15% in Pythonโbut there's an even faster method for large datasets you should know.
-
HashMap Tricks: 4 Interview Problems Where Dict Beats Array
Master HashMap techniques to solve frequency counting, two-sum, anagram grouping, and subarray sum problems faster than array-based approaches
-
Deque vs List for BFS: 6x Speed Difference at Scale
Compare deque vs list for BFS performance and discover why the wrong choice causes 6x slowdowns at scale. Benchmark data reveals the winner.
-
Python list vs tuple vs set: Read/Write Speed Benchmark
Compare Python list, tuple, and set performance with benchmarks revealing read/write speeds and when each data structure shines in real code.
-
Adjacency List vs Matrix: 47% Faster DFS in Interview Code
DFS performance comparison: adjacency list beats matrix by 47% in interview problems. See which graph representation wins and why it matters.
-
Hash Table Collisions: Chaining vs Open Addressing in Python
Compare hash table collision strategies in Pythonโchaining vs open addressing. See benchmarks, implementation tricks, and when each wins.
-
HashMap vs Set: Dict Lookups Beat In-Memory Search by 47x
Dict lookups beat list search by 47x in this 100k-element test. But tiny datasets flip the winner โ see the break-even point with benchmarks.
-
Segment Tree Off-by-One: 5 Bugs That Break Range Queries
Fix the 5 off-by-one bugs that silently break segment trees โ child indexing, range splits, lazy propagation. Includes runnable code + failing test cases.