Loading algorithms…

SOURAV ROY/algorithms

Algorithm Visualizer

A curated, interactive reference for software engineers. Study graph traversal, sorting, dynamic programming, and more — with step-by-step visualizations, complexity analysis, and pseudocode.

22
Algorithms
6
Categories
22
Interactive
0
Coming Soon
/

Showing all 22 algorithms

DifficultyOne core idea with minimal moving parts — ideal if you're new to the category.Combines several concepts or needs careful bookkeeping — comfortable after the Easy tier.Advanced theory, subtle invariants, or heavy state — take it slow and replay steps.
Graph1959

Dijkstra's Shortest Path

InteractiveMediumCombines several concepts or needs careful bookkeeping — comfortable after the Easy tier.

Find the shortest path from a source node to all others in a weighted graph with non-negative edges. The quintessential greedy graph algorithm.

TimeO((V+E) log V)
SpaceO(V+E)
GreedyShortest PathPriority Queue
Explore Visualizer
Explore Dijkstra's Shortest Path visualizer
Graph

Breadth-First Search

InteractiveEasyOne core idea with minimal moving parts — ideal if you're new to the category.

Explore a graph level by level from a source node. Guarantees the shortest path in unweighted graphs.

TimeO(V+E)
SpaceO(V)
TraversalShortest PathQueue
Explore Visualizer
Explore Breadth-First Search visualizer
Graph

Depth-First Search

InteractiveEasyOne core idea with minimal moving parts — ideal if you're new to the category.

Explore as deep as possible before backtracking. Foundation for cycle detection, topological sort, and more.

TimeO(V+E)
SpaceO(V)
TraversalRecursionStack
Explore Visualizer
Explore Depth-First Search visualizer
Graph1958

Bellman-Ford

InteractiveMediumCombines several concepts or needs careful bookkeeping — comfortable after the Easy tier.

Shortest paths from a source that handles negative edge weights and detects negative cycles.

TimeO(V·E)
SpaceO(V)
Shortest PathDynamic ProgrammingNegative Weights
Explore Visualizer
Explore Bellman-Ford visualizer
Graph1962

Floyd-Warshall

InteractiveMediumCombines several concepts or needs careful bookkeeping — comfortable after the Easy tier.

All-pairs shortest path algorithm using dynamic programming. Works with negative weights (no negative cycles).

TimeO(V³)
SpaceO(V²)
All-PairsDynamic ProgrammingShortest Path
Explore Visualizer
Explore Floyd-Warshall visualizer
Graph1968

A* Search

InteractiveHardAdvanced theory, subtle invariants, or heavy state — take it slow and replay steps.

Heuristic-guided shortest path algorithm. Faster than Dijkstra's when a good heuristic is available.

TimeO(E log V)
SpaceO(V)
HeuristicShortest PathAI Pathfinding
Explore Visualizer
Explore A* Search visualizer
Graph1956

Kruskal's MST

InteractiveMediumCombines several concepts or needs careful bookkeeping — comfortable after the Easy tier.

Build a Minimum Spanning Tree by greedily adding the cheapest edges that don't form cycles.

TimeO(E log E)
SpaceO(V)
MSTGreedyUnion-Find
Explore Visualizer
Explore Kruskal's MST visualizer
Graph1957

Prim's MST

InteractiveMediumCombines several concepts or needs careful bookkeeping — comfortable after the Easy tier.

Grow a Minimum Spanning Tree one vertex at a time by always picking the cheapest reachable edge.

TimeO(E log V)
SpaceO(V)
MSTGreedyPriority Queue
Explore Visualizer
Explore Prim's MST visualizer
Sorting1945

Merge Sort

InteractiveMediumCombines several concepts or needs careful bookkeeping — comfortable after the Easy tier.

Divide-and-conquer sorting that guarantees O(n log n) time. Stable, predictable, and widely used in production.

TimeO(n log n)
SpaceO(n)
Divide & ConquerStableRecursive
Explore Visualizer
Explore Merge Sort visualizer
Sorting1959

Quick Sort

InteractiveMediumCombines several concepts or needs careful bookkeeping — comfortable after the Easy tier.

Partition-based sort that is extremely fast in practice despite O(n²) worst case. Pick a pivot, partition the array, recurse — average O(n log n) with great cache locality.

TimeO(n log n) avg
SpaceO(log n)
Divide & ConquerIn-PlacePartitioning
Explore Visualizer
Explore Quick Sort visualizer
Sorting1964

Heap Sort

InteractiveMediumCombines several concepts or needs careful bookkeeping — comfortable after the Easy tier.

Sort in-place using a max-heap. Phase 1 builds the heap; phase 2 repeatedly extracts the max. Guaranteed O(n log n) with no extra memory.

TimeO(n log n)
SpaceO(1)
HeapIn-PlaceSelection
Explore Visualizer
Explore Heap Sort visualizer
Sorting

Bubble Sort

InteractiveEasyOne core idea with minimal moving parts — ideal if you're new to the category.

Repeatedly swap adjacent elements that are out of order. The simplest comparison sort — O(n²) worst case, but with an early-termination optimisation that makes it linear on already-sorted input. Stable and in-place.

TimeO(n²)
SpaceO(1)
ComparisonStableEducational
Explore Visualizer
Explore Bubble Sort visualizer
Sorting1887

Radix Sort

InteractiveMediumCombines several concepts or needs careful bookkeeping — comfortable after the Easy tier.

Sort integers digit by digit. Achieves linear time by exploiting digit structure instead of comparisons.

TimeO(d·(n+k))
SpaceO(n+k)
Non-ComparisonLinear TimeIntegers
Explore Visualizer
Explore Radix Sort visualizer
Searching1946

Binary Search

InteractiveEasyOne core idea with minimal moving parts — ideal if you're new to the category.

Halve the search space at each step in a sorted array. The canonical O(log n) search algorithm.

TimeO(log n)
SpaceO(1)
Divide & ConquerSorted ArrayLogarithmic
Explore Visualizer
Explore Binary Search visualizer
Searching

Linear Search

InteractiveEasyOne core idea with minimal moving parts — ideal if you're new to the category.

Check every element until a match is found. Works on unsorted data; baseline for search algorithm comparisons.

TimeO(n)
SpaceO(1)
Brute ForceUnsortedSequential
Explore Visualizer
Explore Linear Search visualizer
Dynamic Programming

Fibonacci (Memoization)

InteractiveEasyOne core idea with minimal moving parts — ideal if you're new to the category.

Cache overlapping subproblems to compute Fibonacci numbers in linear time instead of exponential.

TimeO(n)
SpaceO(n)
MemoizationOverlapping SubproblemsTop-Down
Explore Visualizer
Explore Fibonacci (Memoization) visualizer
Dynamic Programming

0/1 Knapsack

InteractiveHardAdvanced theory, subtle invariants, or heavy state — take it slow and replay steps.

Maximize value in a capacity-limited knapsack. A classic NP-hard problem solved efficiently with DP.

TimeO(n·W)
SpaceO(n·W)
OptimizationBottom-UpNP-Hard
Explore Visualizer
Explore 0/1 Knapsack visualizer
Dynamic Programming

Longest Common Subsequence

InteractiveMediumCombines several concepts or needs careful bookkeeping — comfortable after the Easy tier.

Find the longest subsequence common to two strings. Used in diff tools and bioinformatics.

TimeO(m·n)
SpaceO(m·n)
Strings2D DPSequence Alignment
Explore Visualizer
Explore Longest Common Subsequence visualizer
Dynamic Programming

Coin Change

InteractiveMediumCombines several concepts or needs careful bookkeeping — comfortable after the Easy tier.

Find the minimum number of coins that make up an amount. Classic unbounded knapsack variant.

TimeO(n·amount)
SpaceO(amount)
OptimizationBottom-UpUnbounded
Explore Visualizer
Explore Coin Change visualizer
Tree

Binary Search Tree

InteractiveMediumCombines several concepts or needs careful bookkeeping — comfortable after the Easy tier.

A BST maintains the ordering property: left < root < right. Enables O(log n) search, insert, and delete.

TimeO(log n) avg
SpaceO(n)
BSTOrderedRecursive
Explore Visualizer
Explore Binary Search Tree visualizer
Tree1962

AVL Tree

InteractiveHardAdvanced theory, subtle invariants, or heavy state — take it slow and replay steps.

A self-balancing BST that maintains O(log n) height using rotations. Guarantees worst-case log n operations.

TimeO(log n)
SpaceO(n)
Self-BalancingRotationsBST
Explore Visualizer
Explore AVL Tree visualizer
Data Structures

Union-Find (DSU)

InteractiveMediumCombines several concepts or needs careful bookkeeping — comfortable after the Easy tier.

Disjoint Set Union with path compression and union by rank. Near-constant time connectivity queries.

TimeO(α(n)) amortized
SpaceO(n)
Disjoint SetsPath CompressionGraph Connectivity
Explore Visualizer
Explore Union-Find (DSU) visualizer

Complexity Cheat Sheet

Big-O time & space for every algorithm in this catalog

Colour key:ExcellentGoodFairPoor
Graph(8)
AlgorithmDifficultyTime ComplexitySpace ComplexityNotes
Dijkstra's Shortest PathMediumO((V+E) log V)O(V+E)Greedy · Shortest Path
Breadth-First SearchEasyO(V+E)O(V)Traversal · Shortest Path
Depth-First SearchEasyO(V+E)O(V)Traversal · Recursion
Bellman-FordMediumO(V·E)O(V)Shortest Path · Dynamic Programming
Floyd-WarshallMediumO(V³)O(V²)All-Pairs · Dynamic Programming
A* SearchHardO(E log V)O(V)Heuristic · Shortest Path
Kruskal's MSTMediumO(E log E)O(V)MST · Greedy
Prim's MSTMediumO(E log V)O(V)MST · Greedy
Sorting(5)
AlgorithmDifficultyTime ComplexitySpace ComplexityNotes
Merge SortMediumO(n log n)O(n)Divide & Conquer · Stable
Quick SortMediumO(n log n) avgO(log n)Divide & Conquer · In-Place
Heap SortMediumO(n log n)O(1)Heap · In-Place
Bubble SortEasyO(n²)O(1)Comparison · Stable
Radix SortMediumO(d·(n+k))O(n+k)Non-Comparison · Linear Time
Searching(2)
AlgorithmDifficultyTime ComplexitySpace ComplexityNotes
Binary SearchEasyO(log n)O(1)Divide & Conquer · Sorted Array
Linear SearchEasyO(n)O(1)Brute Force · Unsorted
Dynamic Programming(4)
AlgorithmDifficultyTime ComplexitySpace ComplexityNotes
Fibonacci (Memoization)EasyO(n)O(n)Memoization · Overlapping Subproblems
0/1 KnapsackHardO(n·W)O(n·W)Optimization · Bottom-Up
Longest Common SubsequenceMediumO(m·n)O(m·n)Strings · 2D DP
Coin ChangeMediumO(n·amount)O(amount)Optimization · Bottom-Up
Tree(2)
AlgorithmDifficultyTime ComplexitySpace ComplexityNotes
Binary Search TreeMediumO(log n) avgO(n)BST · Ordered
AVL TreeHardO(log n)O(n)Self-Balancing · Rotations
Data Structures(1)
AlgorithmDifficultyTime ComplexitySpace ComplexityNotes
Union-Find (DSU)MediumO(α(n)) amortizedO(n)Disjoint Sets · Path Compression

More interactive visualizers are being added continuously·Press/to search,Escto clear