Algorithm visualizations
Pick an algorithm and watch it run step by step — the array, graph or tree it works on, and every variable that changes. Each one is traced from a real execution, never a pre-recorded animation.
Sorting
5Bubble Sort
O(n²)The simplest sort — watch the largest value bubble to the end each pass.
VisualizeInsertion Sort
O(n²)Build the sorted part one card at a time — the way you sort a hand of cards.
VisualizeSelection Sort
O(n²)Find the smallest remaining value each pass and swap it into place.
VisualizeMerge Sort
O(n log n)Split until single elements, then merge sorted halves back together — O(n log n), always.
VisualizeQuick Sort
O(n log n) averagePartition around a pivot, then recurse — the fastest sort in practice.
VisualizeSearching
4Binary Search
O(log n)Halve the search space every step — find a value in a sorted array in O(log n).
VisualizeLinear Search
O(n)Check every element until you find it — the baseline every other search beats.
VisualizeTwo Pointers
O(n)Close in from both ends of a sorted array — O(n) instead of O(n²).
VisualizeSliding Window
O(n)Reuse the previous window's answer instead of recomputing it.
VisualizeGraphs
4Breadth-First Search (BFS)
O(V + E)Explore a graph level by level using a queue — shortest paths on unweighted graphs.
VisualizeDepth-First Search (DFS)
O(V + E)Go as deep as possible before backtracking — the recursion tree made visible.
VisualizeDijkstra's Algorithm
O(V²) simple, O(E log V) with a heapShortest paths on a weighted graph — always expand the closest unfinished node.
VisualizeTopological Sort
O(V + E)Order tasks so every dependency comes first — Kahn's algorithm with in-degrees.
VisualizeTrees
3Binary Search Tree
O(h)An ordered tree where left < node < right — insert, search and traverse.
VisualizeBinary Tree Traversal
O(n)In-order, pre-order, post-order — where the visit sits in the recursion.
VisualizeSegment Tree
O(log n) per queryRange queries and point updates in O(log n) on an array-shaped tree.
VisualizeDynamic Programming
4Fibonacci with Memoization
O(n)Turn exponential recursion into linear time by caching subresults.
Visualize0/1 Knapsack
O(n·W)Take it or leave it — the DP table that defines the field.
VisualizeLongest Common Subsequence
O(n·m)How much two strings share, in order — the basis of diff.
VisualizeCoin Change
O(n·amount)Fewest coins for an amount — where greedy fails and DP works.
VisualizeData Structures
5Union-Find (DSU)
O(α(n)) per opMerge disjoint sets and query connectivity almost in constant time.
VisualizeLinked List
O(n) traverseNodes connected by pointers — traversal and insertion made visible.
VisualizeStack and Queue
O(1) per operationLast-in-first-out versus first-in-first-out, side by side.
VisualizePriority Queue (Binary Heap)
O(log n) push/popAlways pop the largest — a tree hiding inside an array.
VisualizePrefix Sums
O(n) build, O(1) queryPrecompute once, then answer any range sum with a single subtraction.
Visualize