$./bubblesort
preset:
2 step/s
# algorithm
1bubbleSort(A, n)
2begin
3 for i0 to n-2 do
4 swappedfalse
5 for j0 to n-i-2 do
6 if A[j] > A[j+1] then
7 swap A[j]A[j+1]
8 swappedtrue
9 if not swapped then
10 return // early exit
11end
# array visualization
64
0
34
1
25
2
12
3
22
4
11
5
90
6
comparing swapping sorted active
# variables
i
j
pass
swapped
false
# statistics
sorted
0 / 7
unsorted
7
# current comparison
No active comparison
# current action
select a preset and click "run" to begin...
# array state
[64,34,25,12,22,11,90]