← Back to Gallery

Bubble Sort

Comparisons:0
Swaps:0
Array Accesses:0
Pass:0
Status:Ready

Bubble Sort

Repeatedly steps through the list, compares adjacent elements, and swaps them if they are in the wrong order. Larger values "bubble" to the end.

Worst:   O(n²)
Average: O(n²)
Best:    O(n) (optimized, sorted input)
Space:   O(1)

Good for: educational purposes, nearly-sorted small arrays.