Bubble Sort Visualizer

Watch how Bubble Sort compares adjacent elements and gradually moves larger elements to their correct positions.

Time: O(n²)
Space: O(1)
Stable: Yes
In-place: Yes
Fast (200ms)Slow (2000ms)
Progress: Step 1 of 0Pass 0 of 0
640
341
252
123
224
115
906
Unsorted
Comparing
Swapping
Sorted

Current Step:

Click Start to begin the Bubble Sort visualization

Algorithm Details

Best Case:O(n)
Average Case:O(n²)
Worst Case:O(n²)
Space:O(1)
Stable:Yes
In-place:Yes

When to Use Bubble Sort

  • Educational purposes and learning
  • Very small datasets (< 10 elements)
  • When simplicity is more important than efficiency
  • Large datasets (too slow)
  • Production systems requiring performance