Data Structures and Algorithms Diagrams
How Common Growth Rates Compare
ChartOperations performed as input size grows, for six growth rates.
Upper, Lower, and Tight Bounds
ChartO, Ω, and Θ as curves that hold f(n) in from n₀ onward.
Merge Sort's Recursion Tree
StructureWork per level of merge sort on eight elements, summed.
The Call Stack During Factorial(4)
C4 · DynamicFour stack frames pushed by the calls, then popped by the returns.
Naive Fibonacci's Repeated Calls
StructureThe calls F(5) makes, and the ones memoization removes.
Append Cost in a Doubling Dynamic Array
ChartCost of each of 33 appends, with copies at each doubling.
A Variable-Size Sliding Window
FlowThe windows the shortest-sum scan passes through, edge by edge.
Rectangular and Jagged Arrays in Memory
StructureOne contiguous block versus an array of separate row arrays.
Singly and Doubly Linked Lists
StructureNodes joined by pointers, and an insertion that changes two of them.
Reversing a Linked List
FlowHow the previous and current references flip one Next pointer per pass until the list points the other way.
Floyd's Cycle Detection
FlowA slow and a fast reference closing on each other inside a loop.
A Queue in a Circular Buffer
StructureHead and tail indices wrapping around a fixed array.
Growing a Wrapped Circular Buffer
FlowWhy growing a full, wrapped queue copies its elements front first instead of slot by slot.
Two Ways to Resolve a Collision
StructureChaining and linear probing placing two keys that share a slot.
Inside Dictionary
Structure
How a .NET dictionary keeps its chains as integer links inside two arrays instead of as linked nodes.
Parts of a Tree
StructureRoot, internal nodes, leaves, depth, height, and a subtree in one tree.
The Same Keys, Two Tree Shapes
StructureInsertion order decides a binary search tree's height.
Deleting a Node with Two Children
FlowHow a binary search tree replaces a deleted key with its in-order successor and keeps its ordering rule.
A Binary Heap as a Tree and as an Array
StructureOne min-heap drawn as a tree and stored as an array.
Removing the Minimum from a Heap
FlowHow a min-heap refills its root and sifts the moved element down one path to restore the order rule.
A Trie Holding Four Words
Structurecar, cart, cat, and dog stored letter by letter, sharing prefixes.
A Tree Rotation
StructureA right rotation at y lifts x without breaking search order.
An AVL Double Rotation
StructureThe left-right case fixed by a left rotation, then a right rotation.
A Segment Tree Answering a Range Sum
StructureSum(2, 6) over eight values, answered from three stored sums.
What Each Fenwick Tree Slot Covers
StructureThe block each slot sums, and the slots a query and an update touch.
One Graph, Two Representations
StructureThe same four-vertex graph as an adjacency list and a matrix.
Breadth-First and Depth-First Visit Order
FlowThe order BFS and DFS reach the same six vertices.
Detecting a Cycle in a Directed Graph
FlowAn edge to a finished vertex versus an edge back into the current path.
Dijkstra's Algorithm on a Small Graph
FlowThe order vertices settle, and the distance each settles at.
Cells Explored by Dijkstra and A*
ChartThe same grid search with and without a distance estimate.
A Topological Order of Build Steps
FlowSix build steps with dependencies, ordered so each follows its prerequisites.
Path Compression in Union-Find
StructureOne Find flattening the path it walked to the root.
Kruskal's Algorithm Building a Minimum Spanning Tree
FlowEdges taken cheapest first, skipping any that would close a cycle.
A Reverse Edge Undoing a Poor Choice
FlowHow a residual reverse edge lets a later path reroute earlier flow.
Binary Search Step by Step
FlowHow binary search halves the range it still has to check with each comparison until it finds a match or the range is empty.
A Rotated Sorted Array
ChartA rotated sorted array cut at its first midpoint, with the sorted half marked.
A Comparison Sort as a Decision Tree
StructureThe comparisons a sort makes on three elements, drawn as a tree with one leaf per possible order.
The Edit Distance Table
StructureThe dynamic programming table for turning horse into ros, with the path of edits traced back from the answer.
Scheduling Meetings by Earliest Finish
ChartSix meeting requests on a timeline, with the three that earliest-finish-first selects.
Backtracking Through Four Queens
StructureThe partial boards a backtracking search visits for four queens, with dead ends pruned and both solutions found.
Found this useful? Share it:
Share on LinkedIn