Sorting Algorithm Visualizer
Visualize sorting algorithms step-by-step. Compare bubble sort, quick sort, merge sort, and more.
Bubble Sort

Repeatedly steps through the list, compares adjacent elements and swaps them if they are in the wrong order.

O(n)
Best Case
O(n^2)
Average Case
O(n^2)
Worst Case
O(1)
Space
Visualization
Sort Results
187
Total Comparisons
101
Total Swaps
289
Total Steps
20
Array Size
Color Legend
default
comparing
swapping
sorted
pivot

Time Complexity Reference

Bubble Sort: O(n) best, O(n^2) average/worst
Selection Sort: O(n^2) all cases
Insertion Sort: O(n) best, O(n^2) average/worst
Quick Sort: O(n log n) best/average, O(n^2) worst
Merge Sort: O(n log n) all cases

Looking for more tools? Visit ToolJar for additional free calculators and converters.