Interactive visualizations of common algorithms used in LeetCode problems.
Repeatedly swap adjacent out-of-order elements.
O(n²)StableInsert each element into its correct position. Fast for nearly sorted.
O(n²)StableFind minimum, swap to front each pass.
O(n²)Divide-and-conquer: split, sort, merge.
O(n log n)StablePartition around pivot, recurse on halves.
O(n log n) avgIn-placeBuild max-heap, extract max repeatedly. LC 215, 347.
O(n log n)In-placeDistribute into buckets, sort each, concatenate. LC 347, 451.
O(n+k) avgScan every element one by one.
O(n)Halve the search space each step on sorted data. LC 704, 33, 153.
O(log n)Level-by-level exploration using a queue. LC 102, 200, 994.
O(V+E)Shortest PathExplore as deep as possible, then backtrack. LC 200, 695, 79.
O(V+E)StackExpand from S and E simultaneously; meet in the middle. LC 127, 433, 752.
O(b^(d/2))FasterEnqueue all sources at t=0; spread like ripples. LC 994, 542, 1162.
O(V+E)Multi-startDFS all paths S→E; undo visited on backtrack. LC 79, 980, 1219.
O(4^V)All pathsShortest paths in weighted graphs (non-negative). LC 743, 1631.
O((V+E) log V)Min-HeapShortest paths with negative weights. Detects negative cycles. LC 787.
O(V·E)All-pairs shortest paths via intermediate vertices. LC 2642.
O(V³)Find ordering in a DAG (Kahn's BFS). LC 207, 210, 269.
O(V+E)Track connected components with path compression. LC 200, 547, 684.
O(α(n))Converge left & right on sorted array to find target sum. LC 167, 15, 11.
O(n)SortedFixed-size window slides to find max sum subarray. LC 643, 209, 3, 76.
O(n)O(1) range-sum queries after O(n) build. LC 303, 304, 560, 523.
O(1) queryMaximum subarray sum in one pass. LC 53, 152, 918.
O(n)O(1) range updates, prefix-sum to build result. LC 370, 1109.
O(n)Inorder / Preorder / Postorder / Level-order with visit numbering. LC 94, 144, 145, 102.
O(n)DFS / BFSPost-order DFS: bubble p/q up; first node holding both is LCA. LC 236, 235, 1123.
O(n)Post-order