Visualize
Sorting
Watch bubble, quick, merge, insertion and selection sort run step-by-step.
Module · Sorting
Sorting Algorithm Visualizer
Watch comparisons, swaps, and sorted regions unfold in real time.
70
57
83
35
35
35
87
89
24
73
Comparing Swapped Sorted
Comparisons
0
Swaps
0
Current Step
0
Algorithm
Bubble Sort
Operation History
- #1Generated a random array for sorting.
Time Complexity
Bubble Sort
- Best
- O(n)
- Average
- O(n²)
- Worst
- O(n²)
- Space
- O(1)
How It Works
Bubble Sort repeatedly compares adjacent elements and swaps them if they are in the wrong order. Larger values gradually "bubble" toward the end of the array.
Yellow bars indicate elements being compared. Green bars show a swap in progress. Blue bars mark elements already in their final sorted position.