Algomination
Data Structures
AboutContact

Algomination

Learn algorithms and data structures through smooth, interactive visualizations.

SortingSearchingArray AlgorithmsData StructuresAboutContact

© 2026Algomination. Created by Omang Rawat & Rahul Soni.

Omang Rawat
Rahul Soni
All sorting algorithms

Bubble Sort

Time O(n²)Space O(1)

Repeatedly swaps adjacent out-of-order pairs; the largest value bubbles to the end each pass.

5
3
8
1
9
2
7
Starting Bubble Sort.
Step 1 / 37
ComparingSwappingSorted

About Bubble Sort

Repeatedly swaps adjacent out-of-order pairs; the largest value bubbles to the end each pass.

Time complexity: O(n²). Space complexity: O(1).

How it works, step by step

Core idea — Repeatedly walk the array swapping any adjacent pair that's out of order.

What each pass accomplishes — After each full pass the largest value still unsorted has 'bubbled' all the way to its final place at the end — so the sorted region grows by one from the right every pass.

Use the interactive visualizer above to run Bubble Sort on your own input and watch every comparison, swap, and operation animate step by step — pause, scrub, or replay at any speed.