Data structures & algorithms
Explore concepts as a connected map instead of a flat list. Follow families, see prerequisites, and understand what each topic unlocks next.
New learning track
If you want to move from algorithmic building blocks into production architecture, start the new system design atlas with a deep dive on designing a rate limiter at scale.
Topics
63
Every topic is linked by family, prerequisites, and what it unlocks.
Families
12
Trees sit under graphs, so conceptual navigation mirrors the underlying theory.
Algorithms
20
Traverse, search, sort, and optimize with clear follow-up suggestions.
Learning paths
17
Curated routes help you move from fundamentals to more specialized topics.
Search, filter, and regroup the atlas without losing context. The current search and filters stay in the URL, so it is easier to revisit the same slice after opening a topic.
Browse by family
Topic type
Tags
Focus on a path to shrink the grid to a coherent sequence instead of a flat list.
Start with graph shape, then layer traversal, connectivity structure, and both single-source and all-pairs path algorithms.
See the spectrum from plain BFS to deque-based 0-1 BFS to priority-queue shortest paths and dense all-pairs DP.
Learn how sequence-shaped data unlocks queues, stacks, windows, and fast pointer manipulations.
See how order can come from sorted arrays, search trees, skip lists, disk-friendly indexes, heaps, and prefix trees.
Compare fanout-heavy indexes, write-optimized trees, and external-memory sorting in one storage-oriented path.
Start with static prefix tricks, then move into offline, persistent, dynamic, and precomputed range-query structures.
Flatten subtrees, jump through ancestors, and break tree paths into array segments instead of climbing naively.
Move from prefix reuse and rolling hashes to suffix-based indexing and automata.
A reusable set of problem-solving moves for brute-force search, greedy choices, memoized state, and advanced DP optimization.
Go beyond traversal into SCCs, critical edges, degree structure, and other non-shortest-path graph properties.
Build the full ladder from ancestor queries to heavy-light decomposition and historical segment trees.
Compare rolling hashes, sorted suffixes, automata, and palindrome-specific structure.
See how reordering queries, rolling back state, and preserving versions can replace online complexity.
Turn transition formulas into line queries and move from hull geometry to dynamic Li Chao trees.
Learn how approximate membership, frequency, and cardinality structures trade tiny errors for massive scale.
Connect local eviction policy with distributed key placement and system-scale cache design.
See how external sorting and join strategies turn in-memory algorithms into database execution plans.
63 topics match the current search and filters, grouped by family.
Group matching topics
Keep the atlas grouped by conceptual families so parent-child relationships stay visible.
Nodes, edges, traversal, connectivity, and shortest paths.
13 topics
Explore a graph level by level using a queue. BFS finds the shortest path in unweighted graphs and is fundamental to many graph algorithms.
Builds on
Graph Fundamentals, Queue
Unlocks
0-1 BFS, Dijkstra's Algorithm, Minimum Spanning Tree +1 more
Dive as deep as possible before backtracking. DFS is essential for detecting cycles, topological sorting, and exploring all paths in a graph.
Builds on
Graph Fundamentals, Stack & Monotonic Stack
Unlocks
Topological Sort, Bridges and Articulation Points, Eulerian Path +5 more
Learn the core language of nodes, edges, paths, and cycles. Graphs are the broad container that trees, BFS, DFS, Dijkstra, and MST all live inside.
Start here
Foundational enough to read on its own.
Unlocks
BFS — Breadth-First Search, DFS — Depth-First Search, 0-1 BFS +9 more
Find shortest paths in graphs whose edge weights are only 0 or 1 using a deque instead of a heap.
Builds on
BFS — Breadth-First Search, Graph Fundamentals, Deque (Double-Ended Queue)
Find the shortest path in weighted graphs with non-negative edges. Dijkstra is BFS with a priority queue — it processes nodes in order of cumulative distance.
Builds on
BFS — Breadth-First Search, Graph Fundamentals, Heap & Priority Queue +1 more
Find the subset of edges that connects all vertices with minimum total weight. Kruskal's and Prim's are the two classic approaches.
Builds on
Graph Fundamentals, Union-Find (Disjoint Set), Heap & Priority Queue +1 more
Order the nodes of a DAG so that every edge points forward. Essential for dependency resolution, build systems, and scheduling.
Builds on
DFS — Depth-First Search, Graph Fundamentals
Track connected components efficiently with near-constant time union and find operations. The backbone of Kruskal's MST and dynamic connectivity.
Builds on
Graph Fundamentals
Unlocks
Minimum Spanning Tree, DSU Rollback
Use DFS timestamps and low-link values to find the edges and vertices whose removal disconnects an undirected graph.
Builds on
DFS — Depth-First Search, Graph Fundamentals
Add an undo stack to Union-Find so merges can be reversed during offline divide-and-conquer or time-travel style processing.
Builds on
Union-Find (Disjoint Set)
Traverse every edge exactly once by checking degree conditions and then building the walk with Hierholzer's algorithm.
Builds on
DFS — Depth-First Search, Graph Fundamentals
Compute all-pairs shortest paths by gradually allowing more intermediate vertices. This is the clean dynamic-programming answer to dense shortest-path queries.
Builds on
Graph Fundamentals, Dynamic Programming
Find strongly connected components in one DFS by tracking discovery times, low-link values, and the active stack.
Builds on
DFS — Depth-First Search, Graph Fundamentals
Hierarchies and constrained graphs. A tree is a connected acyclic graph.
8 topics
Understand roots, parents, children, depth, height, and traversal orders. A tree is a graph with enough structure to make many problems much simpler.
Trees is a special case of Graphs.
Builds on
Graph Fundamentals
Unlocks
Binary Search Tree (BST), Heap & Priority Queue, Binary Lifting +10 more
A sorted tree structure enabling O(log n) search, insert, and delete. Foundation for balanced trees, sets, and maps.
Trees is a special case of Graphs.
Builds on
Tree Fundamentals, Binary Search
Unlocks
Treap, B-Tree, B+ Tree +1 more
A complete binary tree where every parent is smaller (or larger) than its children. The backbone of Dijkstra, event scheduling, and top-k problems.
Trees is a special case of Graphs.
Builds on
Tree Fundamentals
Unlocks
Dijkstra's Algorithm, Minimum Spanning Tree, Treap +1 more
Jump upward in a rooted tree by powers of two to answer k-th ancestor and many LCA-style queries quickly.
Trees is a special case of Graphs.
Builds on
Tree Fundamentals
Unlocks
Lowest Common Ancestor
Flatten a rooted tree into an array so subtree problems become range problems. This is the bridge between trees and range-query structures.
Trees is a special case of Graphs.
Builds on
DFS — Depth-First Search, Tree Fundamentals
Unlocks
Binary Lifting, Heavy-Light Decomposition, Lowest Common Ancestor
Break tree paths into O(log n) heavy-chain segments so path queries can ride on top of a segment tree instead of walking edge by edge.
Trees is a special case of Graphs.
Builds on
DFS — Depth-First Search, Tree Fundamentals, Lowest Common Ancestor +1 more
Unlocks
Persistent Segment Tree
Find the deepest shared ancestor of two nodes in a rooted tree. LCA is a core tree-query problem that ties together DFS, binary lifting, and Euler tours.
Trees is a special case of Graphs.
Builds on
DFS — Depth-First Search, Tree Fundamentals
Unlocks
Heavy-Light Decomposition
Combine binary-search-tree ordering with heap priorities to get a balanced randomized tree with elegant split and merge operations.
Trees is a special case of Graphs.
Builds on
Tree Fundamentals, Binary Search Tree (BST), Heap & Priority Queue
Static and dynamic range aggregates via indexed trees, segment trees, and precomputed tables.
8 topics
Precompute cumulative totals so any range sum becomes one subtraction. Prefix sums are the first serious range-query idea everyone should know.
Start here
Foundational enough to read on its own.
Unlocks
Difference Array, Fenwick Tree (Binary Indexed Tree), Mo's Algorithm +2 more
Apply many range updates in O(1) each, then rebuild the final values with one prefix pass. Difference arrays are the update-side twin of prefix sums.
Builds on
Prefix Sum
Unlocks
Fenwick Tree (Binary Indexed Tree), Segment Tree
Maintain prefix sums with O(log n) updates and queries using one tiny bit trick. Fenwick trees are the lightest dynamic range-query structure worth knowing.
Builds on
Prefix Sum
Unlocks
Euler Tour Technique
Maintain dynamic line insertion and min/max queries by storing line candidates in a segment tree over x-values.
Builds on
Segment Tree, Convex Hull Trick
Reorder offline range queries so a moving window can answer them with small pointer adjustments instead of rebuilding from scratch.
Builds on
Prefix Sum
Keep every version of a segment tree by path-copying only the changed nodes.
Builds on
Segment Tree
Answer range queries and point updates in O(log n). Segment trees are the go-to structure for range sum, range min, and similar problems.
Builds on
Tree Fundamentals, Prefix Sum
Unlocks
Euler Tour Technique, Heavy-Light Decomposition, Li Chao Tree +1 more
Answer static range minima, maxima, or gcd queries in O(1) after O(n log n) preprocessing. Sparse tables are pure precomputation power.
Builds on
Prefix Sum
State that flows from one end to the other: lists, deques, stacks, and windows.
6 topics
Push and pop from both ends in O(1). A deque can behave like a queue, a stack, or a monotonic window depending on how you use it.
Builds on
Queue
Unlocks
BFS — Breadth-First Search, 0-1 BFS, Stack & Monotonic Stack +2 more
Reverse, detect cycles, merge sorted lists. Linked lists test your pointer manipulation skills — every operation is about rewiring next pointers.
Start here
Foundational enough to read on its own.
Unlocks
Deque (Double-Ended Queue), Queue, Stack & Monotonic Stack +3 more
Process work in first-in, first-out order. Queues are the missing linear-structure foundation behind BFS, buffering, and fair scheduling.
Start here
Foundational enough to read on its own.
Unlocks
BFS — Breadth-First Search, Deque (Double-Ended Queue), Monotonic Queue
LIFO data structure for expression evaluation, backtracking state, and the powerful monotonic stack pattern for next-greater-element problems.
Start here
Foundational enough to read on its own.
Unlocks
DFS — Depth-First Search, Eulerian Path, Backtracking
Shrink O(n²) brute force to O(n) by maintaining a window or two converging pointers. The go-to technique for subarray and subsequence problems.
Start here
Foundational enough to read on its own.
Unlocks
Monotonic Queue
Maintain sliding-window candidates in sorted order inside a deque so each window maximum or minimum is available in O(1).
Builds on
Deque (Double-Ended Queue), Queue, Two Pointers & Sliding Window
Unlocks
Dynamic Programming
Monotonic predicates, ordered data, and pruning search space aggressively.
1 topic
Partition, merge, and reorder data so later operations become easier.
2 topics
Divide the array in half, sort each half, merge them back. Merge sort is the gold standard for stable, predictable O(n log n) sorting.
Start here
Foundational enough to read on its own.
Unlocks
External Merge Sort, Hash Join & Merge Join, LSM Tree
Pick a pivot, partition around it, recurse on both sides. Quick sort is the fastest general-purpose sort in practice despite O(n²) worst case.
Start here
Foundational enough to read on its own.
Reusable paradigms like greedy choice, backtracking, and dynamic programming.
4 topics
Systematically explore all possible solutions by building candidates incrementally and abandoning paths that cannot lead to valid solutions.
Builds on
DFS — Depth-First Search, Tree Fundamentals
Make the locally optimal choice at each step to find a global optimum. Greedy works when the problem has optimal substructure and the greedy choice property.
Start here
Foundational enough to read on its own.
Unlocks
Dijkstra's Algorithm, Minimum Spanning Tree
Maintain a set of lines so DP transitions of the form m*x + b can be optimized by querying only the best candidate line.
Builds on
Dynamic Programming
Unlocks
Li Chao Tree
Break a problem into overlapping subproblems, solve each once, reuse the results. DP turns exponential brute force into polynomial time.
Start here
Foundational enough to read on its own.
Unlocks
Floyd-Warshall, Convex Hull Trick
Prefix-aware structures and text-centric search strategies.
8 topics
Search for a pattern in linear time by reusing information about its own prefixes instead of restarting after mismatches.
Start here
Foundational enough to read on its own.
Unlocks
Aho-Corasick, Suffix Array
Search with rolling hashes so most windows can be rejected with arithmetic instead of full character comparisons.
Start here
Foundational enough to read on its own.
Unlocks
Suffix Array
A tree-like data structure for efficient string storage and prefix-based retrieval. Essential for autocomplete, spell checking, and word search problems.
Builds on
Tree Fundamentals
Unlocks
Aho-Corasick
Compute how much of the global prefix matches at every position, then reuse the active Z-box to stay linear.
Start here
Foundational enough to read on its own.
Unlocks
Manacher
Match many patterns in one pass by augmenting a trie with failure links. This is multi-pattern search done at scale.
Builds on
Trie (Prefix Tree)
Find the longest palindromic substring in linear time by reusing information from the rightmost known palindrome.
Start here
Foundational enough to read on its own.
Sort all suffixes of a string once, then answer many substring questions by binary searching the sorted order.
Builds on
Binary Search
Compress all substrings of a string into a linear-size automaton with suffix links.
Start here
Foundational enough to read on its own.
Fast membership tests, key/value indexing, and amortized constant-time access.
1 topic
Database indexes, cache policies, query operators, sharding, and external-memory algorithms.
8 topics
Store many keys per node so ordered search stays shallow and expensive page reads stay low.
Builds on
Tree Fundamentals, Binary Search
Unlocks
B+ Tree
Keep routing keys in internal nodes and all records in linked leaves so point lookups stay shallow and range scans stay fast.
Builds on
B-Tree
Treat cache eviction as an algorithm choice: recency, frequency, adaptation, and admission all optimize different workloads.
Builds on
Linked List Operations, Hash Map
Map keys onto a ring so cluster membership changes move only nearby keys instead of reshuffling the whole keyspace.
Builds on
Hash Map
Sort data larger than RAM by generating sorted runs and merging them with mostly sequential disk I/O.
Builds on
Heap & Priority Queue, Merge Sort
Unlocks
Hash Join & Merge Join
Compare the two most important database join strategies: build-and-probe hashing versus ordered merge scanning.
Builds on
Merge Sort, Hash Map
Trade read complexity for write throughput by buffering writes in memory, flushing sorted runs, and compacting them in the background.
Builds on
Merge Sort, Skip List
Layer multiple forward-pointer lists on top of each other so ordered search behaves like a randomized tree while staying list-based.
Builds on
Linked List Operations, Binary Search
Unlocks
LSM Tree
Approximate membership, cardinality, and frequency structures for high-volume systems.
3 topics
Use tiny approximate membership structures to reject absent keys cheaply before touching slower storage or larger indexes.
Probabilistic systems is a special case of Systems & storage.
Builds on
Hash Map
Estimate item frequencies in a stream with a tiny counter matrix, a few hash functions, and a guaranteed one-sided error.
Probabilistic systems is a special case of Systems & storage.
Builds on
Hash Map
Estimate the number of distinct items in a huge stream with tiny registers and the statistics of rare hash patterns.
Probabilistic systems is a special case of Systems & storage.
Builds on
Hash Map
Compact state, masks, parity tricks, and low-level arithmetic.
1 topic