Bubble sort · step 0 of 37
Initial array
Bubble sort will compare adjacent values from left to right.
- Comparisons
- 0
- Writes
- 0
- 1repeat a pass through the unsorted values
- 2if values[i] > values[i + 1]
- 3swap values[i] and values[i + 1]
- 4mark the largest remaining value as sorted
- 5stop when a pass makes no swaps
Exam trace note
Write the array only after the highlighted operation. Do not skip a comparison simply because no value moved.
Timeline
Step 0 of 37
Live measurements
- Current step
- 0.00
- Final step
- 37.0
- Comparisons
- 0.00
- Array writes
- 0.00
- Pass / range
- 0.00
- Active left index
- -1.00
- Active right index
- -1.00
- Found index
- -1.00
- Array ordered
- 0.00
- Trace complete
- 0.00