Bubble Sort

Repeatedly swap adjacent elements if out of order. Simple but O(n²).

Unsorted
Comparing
Swapping
Sorted

Controls

Time: O(n²) | Space: O(1)

Stats