Algomination
Sorting
Searching
Data Structures
About
Contact
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.
Visualize
Random
5
3
8
1
9
2
7
Starting Bubble Sort.
Play
Step 1 / 37
0.5×
1×
2×
4×
Comparing
Swapping
Sorted