Comparisons:
0
Counts how many times two elements are compared.
Array Accesses:
0
Counts reads/writes to the array. Reading 1 value = +1. Swapping two numbers = +4 (Read A, Read B, Write B to A's spot, Write A to B's spot).
Unsorted
Active
Sorted
New Random Data
Restart Same Data
Previous Step
Play / Pause
Next Step
Changes the initial order of the data to see how algorithms perform differently.
Live Explanation
Press Play or Step Forward to start the visualization.
Bubble Sort
Time:
O(n²)
Space:
O(1)