47 Data Structures & Algorithms Visualizations
Each widget is a working in-browser implementation — step through the algorithm, watch the data structure update, and see the complexity play out visually. Covers the core DSA toolkit for interviews and teaching.
These visualizations cover the exact patterns that appear in FAANG coding rounds. Every widget includes animated step-through, real Java implementation, time/space complexity, and linked LeetCode problems — so you can watch the pattern execute and then drill it immediately.
Arrays & Strings
- Two Pointers — Pair-sum, dedupe, reverse — the classic two-pointer pattern, animated.
- Sliding Window — Longest substring without repeats — window shrink/expand on conflict.
- Prefix Sum — Range-sum queries in O(1) after O(n) preprocessing.
- KMP String Search — Failure function + match walk; never re-scans text.
- Rabin-Karp — Rolling hash pattern search; hash collisions trigger char-by-char verify.
- Z-Algorithm — Z-array construction; linear-time multi-pattern matching base.
Linked Lists
- Reverse + Floyd Cycle — Iterative reversal and tortoise/hare cycle detection.
- LRU Cache — HashMap + doubly-linked list; O(1) get/put with eviction.
- Merge K Sorted Lists — Min-heap merge — O(N log k).
Stacks & Queues
- Monotonic Stack — Next greater element in O(n); each index pushed/popped once.
- Sliding Window Max — Deque maintains candidates; amortized O(1) per element.
- Min Stack — O(1) getMin via parallel min-stack trick.
Hashing
- Hash Table — Chaining vs open addressing; animated collision handling, load factor, resize.
- Bloom Filter — k hashes → m bits; zero false negatives, tunable false-positive rate.
- Consistent Hashing — Ring + virtual nodes; add/remove a node moves only 1/N keys.
Trees
- BST — Insert/search/delete with unbalanced worst-case demo.
- AVL Tree — LL / RR / LR / RL rotations animated on rebalance.
- Red-Black Tree — Recolor + rotate cases; every path has equal black-height.
- Binary Heap — Sift-up (insert) + sift-down (extract-min); array-backed.
- Segment Tree — Range sum + point update in O(log n); recursive build.
- Fenwick (BIT) — Low-bit trick for prefix-sum updates/queries in O(log n).
- Trie — Prefix tree: insert words, search, prefix lookup.
Graphs
- BFS — Level-order walk; shortest path in unweighted graph.
- DFS — Recursive explore; discovery/finish time coloring.
- Dijkstra — Min-heap relax; fails on negative edges — demo included.
- Bellman-Ford — V-1 relax rounds; handles negative edges, detects negative cycles.
- Floyd-Warshall — All-pairs shortest path; O(V³) DP over intermediate vertices.
- Topological Sort — Kahn's in-degree algorithm; cycle detection included.
- Union-Find — Path compression + union by rank; near-O(1) per op.
- Kruskal MST — Sort edges + union-find; picks lightest cross-cut edge.
- Prim MST — Grow tree from a seed vertex; min-heap over fringe edges.
- Tarjan SCC — DFS + low-link; each SCC popped off the stack once.
Sorting
- Compare Sorts — Bubble / Insertion / Merge / Quick / Heap running side-by-side on the same array.
- Radix + Counting — Non-comparison sort; O(n·k) bucket passes by digit.
Searching
- Binary Search — Classic, first/last occurrence, rotated array — all three animated.
- Ternary Search — Unimodal-function peak finding with two probes per step.
Dynamic Programming
- LIS — Longest increasing subsequence — O(n²) DP + patience-sort O(n log n).
- LCS — Longest common subsequence; 2D DP table with traceback.
- Edit Distance — Levenshtein: insert/delete/replace costs; DP grid + path.
- 0/1 Knapsack — DP table by item × capacity; traceback picks selected items.
- Matrix Chain — Optimal parenthesization; interval DP with split-point k.
- Coin Change — Min coins to make amount; 1D DP with coin choices.
Greedy & Backtracking
- Huffman Coding — Priority queue merges two least-frequent nodes until one tree remains.
- Interval Scheduling — Earliest-finish-first greedy; maximize non-overlapping intervals.
- N-Queens — Backtracking with row/diagonal constraint sets; solution enumeration.
- Sudoku Solver — Backtracking with constraint propagation — watch it backtrack.
Bit Manipulation
- Bit Tricks — popcount, is-power-of-2, lowest-set-bit, XOR swap, subset enumeration.