DSA · Reimagined
Sorting easy time O(n²) space O(1)

Bubble Sort

Repeatedly compare neighbours and swap them if out of order. Each pass carries the largest remaining value to its final place at the right end.

5
0
2
1
9
2
1
3
6
4
3
5

Bubble the largest remaining value to the right on every pass.

1 / 29

Practice

Machine twin: /dsa-viz-v2/bubble-sort.json — the full deterministic run as structured data.