Sorting Algorithm Visualiser

Watch sorting algorithms run step by step. Compare speeds, count operations, and understand exactly what each algorithm is doing at every stage.

Algorithm
Size 20
Speed 5
Array Visualisation
Comparisons: 0
Swaps: 0
Unsorted
Comparing
Swapping
Pivot
Sorted
Press Play to start or Step to go one operation at a time.

Bubble Sort

Repeatedly steps through the list, compares adjacent elements and swaps them if they are in the wrong order. The pass is repeated until the list is sorted.

Best: O(n)
Average: O(n²)
Worst: O(n²)
Space: O(1)
Stable: Yes