DSA Visualizer
Step-by-step, replayable visualizations of algorithms and data structures. Pick a card to open its player; visualizers that are not shipped yet show a coming soon state.
179 of 181 visualizers ready to play.
Basic Algorithms
Foundational algorithms and data structures with small inputs and shared renderer patterns. 53 of 53 ready to play.
Bubble Sort
AvailableRepeatedly swaps adjacent out-of-order pairs until the array is sorted.
Selection Sort
AvailablePicks the smallest remaining element and places it at the front.
Insertion Sort
AvailableBuilds the sorted prefix by inserting each element into place.
Merge Sort
AvailableDivide and conquer: split, sort, then merge sorted halves.
Quick Sort
AvailablePartitions around a pivot and recurses on each side.
Heap Sort
AvailableBuilds a max heap, then extracts the largest element repeatedly.
Linear Search
AvailableScans elements one by one until the target is found.
Binary Search
AvailableHalves the search range on a sorted array each step.
Stack Operations
AvailablePush and pop on a LIFO stack with top tracking.
Queue Operations
AvailableEnqueue and dequeue on a FIFO queue with head and tail.
Linked List Reverse
AvailableFlips node next pointers in place in one pass.
Binary Tree Traversal
AvailablePreorder, inorder, and postorder walks of a binary tree.
BST Operations
AvailableSearch, insert, and delete in a binary search tree.
Min Heap Operations
AvailableInsert and extract-min while sifting to restore heap order.
Graph BFS
AvailableLevel-by-level exploration of a graph from a source node.
Graph DFS
AvailableDepth-first exploration that backtracks when stuck.
Dijkstra
AvailableShortest paths from a source with a priority queue.
Topological Sort
AvailableOrders DAG nodes so every edge points forward.
Kadane Max Subarray
AvailableTracks the best contiguous sum in one pass.
Sliding Window Maximum
AvailableMaintains the maximum of each fixed-size window.
Fibonacci DP
AvailableMemoized recursion and a bottom-up table for Fibonacci numbers.
Number of Islands
AvailableCounts connected groups of land cells in a grid.
Trie Insert and Search
AvailableInserts and searches words through shared prefixes.
Union Find Operations
AvailableUnion and find with path compression on disjoint sets.
N Queens
AvailablePlaces n queens so none attack each other, with backtracking.
Sieve of Eratosthenes
AvailableMarks multiples step by step to find all primes.
Binary Exponentiation
AvailableComputes powers in O(log n) by repeated squaring.
Euclidean GCD
AvailableRepeatedly subtracts or mods until the remainder is zero.
Rabin-Karp Hashing
AvailablePattern matching with rolling hash fingerprints.
Ternary Search
AvailableFinds the peak of a unimodal function.
Josephus Problem
AvailableEliminates every k-th person in a circle.
Gray Code
AvailableCycles through bitmasks changing one bit at a time.
Bit Manipulation
AvailableBitwise tricks: isolation, counting, toggling.
Inclusion-Exclusion
AvailableCounts unions by alternating intersection terms.
Catalan Numbers
AvailableCounts balanced parenthesizations and binary trees.
Pascal Triangle Binomials
AvailableBuilds binomial coefficients row by row.
K-th Order Statistic
AvailableQuickselect pivoting finds the k-th element.
MEX of a Sequence
AvailableFinds the smallest non-negative missing integer.
Next Permutation
AvailableRearranges to the next lexicographic permutation.
Cyclic Sort
AvailablePlaces each value at its index in cycles.
Euler Totient Phi
AvailableCounts integers coprime to n up to n.
Linear Sieve
AvailableComputes primes and smallest factors in linear time.
Modular Inverse
AvailableFinds x with a*x = 1 mod m via extended Euclid.
Chinese Remainder Theorem
AvailableCombines modular congruences into one answer.
Prime Factorization
AvailableSplits a number into its prime factors.
Balanced Bracket Sequences
AvailableStack push-pop verifies balanced parentheses.
String Hashing
AvailableRolling polynomial hashes for substring equality.
Job Scheduling
AvailableGreedy job ordering on a single machine.
Array Rotation
AvailableShifts elements around an array in place.
Stars and Bars
AvailableDistributes identical items into distinct bins.
Two Machine Scheduling
AvailablePartitions jobs to balance two machines.
Schedule with Deadlines
AvailableOrders unit jobs by deadline for max completion.
Submask Enumeration
AvailableIterates all submasks of a mask.
Algorithm Patterns
Interview-pattern algorithms: two pointers, sliding window, DP tables, and classic graph patterns. 41 of 43 ready to play.
Two Pointer Sum
AvailableFinds a pair with a target sum by closing in from both ends.
Container With Most Water
AvailableTwo pointers choose the widest pair of tall walls.
Fast Slow Pointer
AvailableDetects cycles with tortoise and hare pointers.
Monotonic Stack
AvailableMaintains a stack of increasing or decreasing values.
Prefix Sum
AvailablePrecomputes range sums for instant queries.
Knapsack 0-1
AvailablePicks items with maximum value under a weight capacity.
Coin Change
AvailableFinds the fewest reusable coins for an amount and reconstructs one optimal combination.
Longest Common Subsequence
AvailableLongest common subsequence via a DP table.
Longest Increasing Subsequence
AvailableLongest increasing subsequence with a DP or patience table.
Subsets and Permutations
AvailableEnumerates subsets and permutations with recursion trees.
Kruskal MST
AvailableAdds the cheapest safe edge until the tree spans all nodes.
Prim MST
AvailableGrows a minimum spanning tree from a seed node.
A Star Grid
AvailableGrid pathfinding with a heuristic-guided frontier.
Sorting Comparison Lab
AvailableCompares step counts and patterns across sort algorithms.
Matrix Exponentiation
AvailableFast linear recurrences by repeated matrix squaring.
Digit DP
AvailableCounts numbers digit by digit with tight bounds.
Bitmask DP
AvailableSubset DP over bitmasks of small state sets.
Interval DP
AvailableMerges intervals left to right while combining costs.
Tree Diameter
AvailableTwo BFS sweeps find the longest tree path.
Euler Tour
AvailableFlattens a tree into an array via DFS entry-exit times.
Functional Graphs
AvailableEach node points to one target; finds cycles.
Cycle Detection
AvailableDFS timestamps reveal cycles and their members.
Difference Array
AvailableRange adds applied at endpoints, then prefix sums.
Multi-Source BFS
AvailableExpands from many sources simultaneously.
Bidirectional BFS
AvailableMeets in the middle with two expanding frontiers.
Meet in the Middle
AvailableSplits the search space in half and combines.
Expression Parsing
AvailableConverts infix to postfix and evaluates.
2D Prefix Sum
AvailablePrecomputes rectangle sums on a 2D grid.
Monotonic Queue
AvailableMaintains a sliding window min or max.
LRU Cache
AvailableEvicts the least recently used entry on capacity.
Two Heaps
AvailableKeeps medians with a min and max heap.
K-Way Merge
AvailableMerges k sorted lists with a min heap.
Trapping Rainwater
AvailableAccumulates water above elevations between walls.
Stock Trading DP
AvailableDP over days, holding states, and transactions.
Grid DP
AvailablePaths through a grid with obstacle constraints.
Lattice Paths
AvailableCounts monotone grid paths combinatorially.
Matrix Chain Multiplication
AvailableOrders matrix multiplications to minimize cost.
Graph Coloring / Bipartite Check
AvailableTwo-colors components to test bipartiteness.
XOR Basis
AvailableLinear basis of bitsets over GF(2).
15 Puzzle
AvailableSliding tiles; parity decides solvability.
Largest Zero Submatrix
AvailableHistogram trick finds the largest zero rectangle.
Tree from Traversals
Coming soonRebuilds a tree from its traversals.
Trie XOR Max Pair
Coming soonBinary trie finds the max XOR pair.
Advanced Competitive Programming
Competitive-programming depth: flows, string algorithms, geometry, and advanced data structures. 85 of 85 ready to play.
Bellman Ford
AvailableRelaxes all edges repeatedly to find shortest paths.
Floyd Warshall
AvailableAll-pairs shortest paths through intermediate nodes.
Max Flow Dinic
AvailableAugments blocking flows through a level graph.
SCC Tarjan
AvailableFinds strongly connected components with one DFS.
Bipartite Matching
AvailableMatches left and right nodes with augmenting paths.
Bridges and Articulation
AvailableFinds edges and nodes whose removal disconnects the graph.
KMP String Matching
AvailableLinear pattern search using the failure table.
Z Function
AvailableComputes longest common prefix lengths for every position.
Convex Hull Graham
AvailableBuilds the convex hull with a monotonic chain scan.
Sparse Table RMQ
AvailableAnswers range minimum queries in O(1) after an O(n log n) build.
Minimax Game
AvailableSolves perfect-information games with the minimax tree.
Euler Path
AvailableFinds a trail visiting every edge exactly once.
Segment Tree
AvailablePoint updates and range queries in O(log n).
Fenwick Tree
AvailablePrefix sums and point updates with a binary indexed tree.
0-1 BFS
AvailableShortest paths on graphs with 0-1 edge weights via deque.
Edmonds-Karp Max Flow
AvailableFinds max flow with BFS-based augmenting paths.
Aho-Corasick
AvailableMulti-pattern search on a trie with failure links.
Manacher Palindrome
AvailableFinds all palindromic substrings in linear time.
Suffix Array
AvailableSorted suffixes built with doubling or SA-IS.
Sqrt Decomposition
AvailableSplits an array into blocks for fast range queries.
Treap
AvailableRandomized BST with heap priorities.
LCA Binary Lifting
AvailableAncestor jumps of powers of two answer LCA queries.
2-SAT
AvailableSatisfiability of 2-CNF clauses via implication graph.
Min Cost Flow
AvailableSuccessive shortest paths for minimum cost flow.
Hungarian Assignment
AvailableOptimal assignment in O(n^3) with alternating paths.
Heavy Light Decomposition
AvailableSplits trees into heavy paths for log-n queries.
Centroid Decomposition
AvailableRecursively decomposes a tree at centroids.
Mo's Algorithm
AvailableAnswers range queries by clever reordering.
Stoer-Wagner Min Cut
AvailableGlobal min cut by repeated maximum adjacency phases.
Push-Relabel Max Flow
AvailablePushes excess along admissible edges; relabels sinks.
Prufer Code
AvailableEncodes trees as sequences and back.
Polygon Area
AvailableShoelace sums cross products around a polygon.
Point in Polygon
AvailableRay casting tests containment in a polygon.
Segment Intersection
AvailableOrientation tests decide segment crossings.
Circle-Line Intersection
AvailableProjects the line to find circle chord points.
Circle-Circle Intersection
AvailableRadical axis solves the two circle overlap.
Line Intersection
AvailableCramer's rule finds the line crossing point.
Manhattan Distance
AvailableL1 geometry: circles become diamonds.
Closest Pair of Points
AvailableSweep and strip search finds the closest pair.
Line Sweep
AvailableEvent-sorted sweep over segment endpoints.
Convex Hull Trick
AvailableLines queried for max or min at x.
Minimum Enclosing Circle
AvailableRandomized incremental smallest circle.
Half-Plane Intersection
AvailableIntersects half-planes with angular sorting.
Minkowski Sum
AvailableAdds convex polygons edge by edge.
Rotating Calipers
AvailableRotates parallel support lines around a hull.
Pick's Theorem
AvailableRelates area, interior, and boundary lattice points.
Delaunay Voronoi
AvailableTriangulates points; dual is the Voronoi diagram.
Point Location
AvailableBinary search over trapezoids locates a point.
Vertical Decomposition
AvailableSlices the plane at segment endpoints.
Newton Root Finding
AvailableTangent iteration converges to a function root.
Simpson Integration
AvailableApproximates integrals with parabolic arcs.
Simulated Annealing
AvailableTemperature-controlled random hill descent.
Fast Fourier Transform
AvailableButterfly stages transform coefficients to values.
Discrete Logarithm
AvailableBaby-step giant-step solves g^x = a mod p.
Discrete Root
AvailableFinds x^k = a mod p by exponentiation reduction.
Primality Tests
AvailableDeterministic Miller-Rabin witnesses.
Montgomery Multiplication
AvailableMultiplies residues without division by modulus.
Continued Fractions
AvailableIterates floor-and-invert for rationals.
Big Integer Arithmetic
AvailableBase-10 digit arrays with carry arithmetic.
Factorial Modulo
AvailableComputes n! mod p with cancellation trick.
Linear Diophantine Equation
AvailableExtended Euclid solves ax + by = c.
Linear Congruence Equation
AvailableReduces ax = b mod m with gcd checks.
Garner's Algorithm
AvailableLifts residues incrementally across moduli.
Primitive Root
AvailableFinds generators of the multiplicative group.
Factorial Divisors
AvailableCounts p-adic valuation of n!.
Burnside's Lemma
AvailableAverages fixed points over group symmetries.
Bishops on a Chessboard
AvailableCounts non-attacking bishop placements.
Games on Graphs
AvailableDetermines winning states on directed graphs.
Divide and Conquer DP
AvailableSplits DP rows; optimal splits are monotone.
Knuth's Optimization
AvailableQuadrangle inequality narrows split ranges.
Broken Profile DP
AvailableTiles boards row by row on a broken profile.
LCA Tarjan Offline
AvailableOffline DSU answers LCA queries.
Edge Vertex Connectivity
AvailableMax-flow duality for cut sizes.
Flow with Demands
AvailableAdjusts supplies so lower bounds are met.
Strong Orientation
AvailableOrients edges so every node stays reachable.
Tree Painting
AvailableColors tree edges with two-color constraints.
Second Best MST
AvailableReplaces one edge for the next cheapest tree.
DEsopo-Pape
AvailableLabel-correcting shortest paths with deque priority.
Randomized Heap
AvailableMergeable heap with random priorities.
Sqrt Tree
AvailableBlocks and layers give O(1) range queries.
Determinant by Gauss
AvailableRow elimination computes determinant with pivots.
Linear System by Gauss
AvailableGaussian elimination solves linear systems.
Suffix Automaton
AvailableMinimal DFA of all substrings.
Suffix Tree Ukkonen
AvailableOnline suffix tree with suffix links.
Palindrome Automaton
AvailableTwo-trie automaton of distinct palindromes.