Algorithm Visualizers
17 algorithms and data structures, each animated one step at a time with the matching line of pseudocode highlighted as it runs. Pick one to watch it work, change the input, and scrub backwards and forwards through every comparison, swap and pointer move.
New to this? Start with Bubble Sort, then Binary Search, then BFS.
Sorting
From the quadratic sorts everyone learns first to the O(n log n) workhorses. Switch the input to sorted, reversed, nearly sorted or few-unique and watch how the shape of the data changes the amount of work.
Not sure which to open? See what each sorting visualizer shows best.
- Bubble SortbeginnerRepeatedly steps through the list, compares adjacent elements, and swaps them if out of order.O(n²) time · O(1) space
- Selection SortbeginnerFinds the minimum element and places it at the beginning, repeating for each position.O(n²) time · O(1) space
- Insertion SortbeginnerBuilds the sorted array one item at a time by inserting each element into its correct position.O(n²) time · O(1) space
- Merge SortintermediateDivides the array in half recursively, sorts each half, then merges the sorted halves back together.O(n log n) time · O(n) space
- Quick SortintermediateSelects a pivot element, partitions the array around it, then recursively sorts both sides.O(n log n) avg · O(n²) worst · O(log n) space
Searching
Two ways to find a value: check every element, or halve a sorted array until the target is cornered. Compare the step counts to see what sorting your data buys you.
Data Structures
The containers algorithms are built on. In the binary search tree and AVL tree you insert, search and delete your own values and watch the structure respond.
- Stack (LIFO)beginnerLast In, First Out data structure. Push adds to the top, pop removes from the top.O(1) time · O(n) space
- Queue (FIFO)beginnerFirst In, First Out data structure. Enqueue adds to the rear, dequeue removes from the front.O(1) time · O(n) space
- Linked ListbeginnerLinear data structure where each node points to the next. Supports insert, delete, and search with traversal.O(n) time · O(n) space
- Binary Search TreeintermediateTree where left child < parent < right child. Supports O(log n) insert, search, and delete.O(log n) avg · O(n) worst · O(n) space
- AVL TreeadvancedSelf-balancing BST that maintains O(log n) height via rotations after every insert/delete.O(log n) time · O(n) space
- Min/Max HeapintermediateComplete binary tree where parent is always smaller (min) or larger (max) than its children.O(log n) time · O(n) space
- Hash TableintermediateBuckets with chaining: a hash function sends each key to a bucket for O(1) average lookups.O(1) avg · O(n) worst · O(n) space
Graph
Traversal and shortest paths on a small graph you can follow by eye: a queue for breadth-first, a stack for depth-first, and for Dijkstra, always expanding the closest unvisited node.
- BFS (Breadth-First)intermediateExplores a graph level by level using a queue. Finds shortest path in unweighted graphs.O(V+E) time · O(V) space
- DFS (Depth-First)intermediateExplores a graph by going as deep as possible along each branch before backtracking, using a stack.O(V+E) time · O(V) space
- Dijkstra's AlgorithmadvancedFinds the shortest path from a source to all other nodes in a weighted graph with non-negative edges.O(V²) time · O(V) space
Head-to-Head Comparisons
Written guides for the choices that come up most: which sort to use, when binary search pays off, and which traversal fits your graph. Each one ends with a clear verdict.
Sorting
Searching
Data Structures
Prefer a one-page reference? See the Big-O and sorting cheat sheets.