Bubble Sort

Compare adjacent pairs, swap if out of order — repeat until no swaps.

Best: O(n) Avg: O(n²) Worst: O(n²) Space: O(1) Stable
slow fast
Default
Comparing
Swapping
Sorted
Checking
Step
0/0
Pass
0
Comparisons
0
Swaps
0
Inversions Left
0

Algorithm Trace

Press Start to run the animation, or Step to advance one operation at a time.