Bubble Sort
BeginnerRepeatedly swap adjacent pairs until the largest values have bubbled to the end.
- Average
- O(n²)
- Worst
- O(n²)
- Space
- O(1)
- Stable
- Comparison
- In place
Learn sorting, searching and graph algorithms through beautiful interactive visualizations.
The best place to start — one from each major strategy, each with a full visualiser and a written guide.
Repeatedly swap adjacent pairs until the largest values have bubbled to the end.
Grow a sorted prefix by sliding each new value back to where it belongs.
Split the array down to single elements, then merge sorted halves back together.
Partition around a pivot so everything smaller lands left and larger lands right.
Halve a sorted range on every comparison — a million elements in twenty checks.
Explore a graph level by level with a queue — the shortest path on unweighted edges.
Greedily settle the nearest unvisited node to get shortest paths on non-negative weights.
Put a collection in order. The classic proving ground for comparing algorithmic strategies.
8 algorithms available
Find a value inside a collection — and see exactly what sorted order buys you.
2 algorithms available
Traverse networks, find shortest paths, and build minimum spanning trees.
5 algorithms available
Binary search trees, traversals, AVL rotations and heaps.
Knapsack, LCS, edit distance and the art of reusing subproblems.
Search by name, by what it does, or by complexity. Each card opens a full page with an interactive visualiser, pseudo code, implementations in five languages, and a written explanation.
15 algorithms shown.
Repeatedly swap adjacent pairs until the largest values have bubbled to the end.
Scan for the smallest remaining value and swap it into place — one swap per pass.
Grow a sorted prefix by sliding each new value back to where it belongs.
Split the array down to single elements, then merge sorted halves back together.
Partition around a pivot so everything smaller lands left and larger lands right.
Build a max-heap, then repeatedly pull the root to the end of the array.
Count how many times each value occurs, then write the output straight from the tallies.
Sort by one digit at a time, least significant first, using a stable counting pass.
Check every element in order until the target turns up — no assumptions required.
Halve a sorted range on every comparison — a million elements in twenty checks.
Explore a graph level by level with a queue — the shortest path on unweighted edges.
Follow one branch as deep as it goes, then backtrack — a stack, or recursion.
Greedily settle the nearest unvisited node to get shortest paths on non-negative weights.
Grow a minimum spanning tree outward from one node, always taking the cheapest edge out.
Sort every edge by weight and add the cheap ones that don't close a cycle.
The ones that come up most often in technical interviews.
The newest additions to the playground.
Most people learn algorithms in the wrong order. They memorise the complexity table first, then try to reverse-engineer the mechanism from it. That works for passing a quiz and fails the moment an interviewer asks why quick sort degrades to O(n²), because the answer lives in the mechanism, not the table.
A better order is this. First, watch the algorithm run on ten elements slowly enough to narrate what it is doing out loud. Second, find its invariant — the one sentence that is true after every pass, like “the last k elements are the k largest, in final order”. Third, work out what the invariant costs: how many comparisons are needed to maintain it, and how that count grows as the array does. Only then does the complexity table mean anything, because by that point you are reading a summary of something you already understand.
The fourth step is the one people skip: run the algorithm on the input designed to hurt it. Every visualiser here lets you choose a reversed or nearly-sorted array precisely for this. Watching insertion sort finish a nearly-sorted array in one pass, and then watching it crawl through a reversed one, teaches the difference between best and worst case in about fifteen seconds — considerably faster than reading two paragraphs about it, this one included.
Across every sorting visualiser the code is the same: amber is a comparison in progress, coral is a swap or a write, mint means an element has reached its final position, and white marks a pivot or the current minimum. Elements still in play stay violet. Graph visualisers use the same palette — amber for the node being processed, mint for visited, coral for the final path.
Once two algorithms make sense individually, put them side by side on the comparison page and run them on the same array. Seeing bubble sort still grinding through its two-thousandth comparison while quick sort has already finished is the single most persuasive argument for asymptotic analysis I know of.
If you are learning this to build a career rather than to pass a course, the 90-day developer roadmap covers what to do with these fundamentals once you have them, and the other free developer tools here handle the day-to-day jobs — JSON, JWTs, hashing and passwords.
Share a few details and I'll come back within one business day with an honest take, a realistic timeline and a ballpark cost — no pressure, no sales script.
Tell me what you're working on. I'll reply within one business day with honest, practical next steps.