Algorithm Visualizer
Interactive animations for sorting, pathfinding, and tree algorithms. Click any card or use the tabs above.
Bubble Sort
Repeatedly steps through the list, compares adjacent elements and swaps them if they're in the wrong order. The largest values "bubble up" to the end each pass.
Insertion Sort
Builds a sorted portion one element at a time by taking each new element and inserting it into its correct position in the already-sorted left portion.
Merge Sort
Recursively divides the array in half, sorts each half, then merges them back together. Guaranteed O(n log n) but requires extra memory for merging.
Quick Sort
Picks a pivot element and partitions the array around it so elements less than pivot go left, greater go right. Recursively sorts each partition in place.
Heap Sort
Builds a max-heap from the array, then repeatedly extracts the maximum to build the sorted result. Combines good worst-case guarantees with in-place operation.
Breadth-First Search
Explores all neighbors at the current depth before moving deeper. Guarantees the shortest path in an unweighted graph. Uses a queue (FIFO).
Depth-First Search
Dives as deep as possible along each branch before backtracking. Does not guarantee shortest path. Uses a stack (LIFO) — naturally recursive.
Dijkstra's Algorithm
Finds the shortest path in a weighted graph. Uses a priority queue to always expand the currently cheapest node. On an unweighted grid it behaves like BFS.
A* Search
Extends Dijkstra with a heuristic function h(n) estimating distance to the goal. f(n) = g(n) + h(n). With Manhattan distance heuristic it's optimally efficient on grids.
Binary Search Tree
Each node has at most two children. Left subtree contains only nodes with values less than the parent; right subtree only greater values. Supports O(log n) search, insert, and delete on average.