Interactive bubble sort. Watch adjacent values compare and swap one pair at a time; the largest bubbles to the end each pass.
Array · n=8
unsorted
compare
swap
locked
Step 0 / 0
Press Play. Each pass compares adjacent values; the largest bubbles to the end and gets locked.
Speed
for i in 0 … n-1
for j in 0 … n-1-i
if a[j] > a[j+1]
swap a[j], a[j+1]
if no swaps → done
timeline0 / 0
←→space walk steps