Sorting Algorithms
Visualize and compare different sorting algorithms. Watch step-by-step how each algorithm organizes data, and understand their time and space complexity.
Bubble Sort
64
34
25
12
22
11
90
0
1
2
3
4
5
6
Ready to start
Step 0 of 0
Speed:500ms
Default
Comparing
Swapping
Sorted
Pivot
Algorithm Info
Repeatedly swaps adjacent elements if they are in the wrong order.
Best Case
O(n)
Average Case
O(n²)
Worst Case
O(n²)
Space
O(1)
Code Tracing
Watch the visualization alongside the Java code. The current line of execution is highlighted as the algorithm progresses.
Bubble Sort
64
34
25
12
22
11
90
Ready to start
Step 0 / 0
Speed:
Java Code
Loading editor...
Race Mode
Compare multiple algorithms simultaneously! Select the algorithms you want to race and watch them compete to sort the same array.
Algorithm Race
Race Speed:100ms
Keyboard Shortcuts
- Space Play / Pause
- ← Step Backward
- → Step Forward
- R Reset
Tips
- • Use the speed slider to slow down or speed up the animation
- • Click Randomize to generate a new array
- • Step through manually to understand each operation
- • Compare algorithms by switching between them
- • Watch the comparison and swap counters to compare efficiency