Each bar is one array element; height encodes its value. The highlighted (yellow) bars are the ones the algorithm is currently comparing; a swap animates two bars trading positions.
Bubble: O(n^2) repeatedly swap adjacent out-of-order pairs
Insertion: O(n^2) grow a sorted prefix, insert each new element
Quick: O(n log n) avg partition around a pivot, recurse
Merge: O(n log n) split, sort halves, merge sorted runs
- Algorithm — switches the sorting strategy driving the animation.
- Array size — how many bars to sort; larger arrays make the O(n²) vs O(n log n) gap visible in step count.
- Speed — steps per second; Pause/Resume freezes mid-sort so you can inspect the current comparison.
- Shuffle — generates a fresh random array and restarts.
Comparison count is exactly why O(n²) algorithms fall behind fast: watch the comparisons counter climb far quicker for Bubble/Insertion than for Quick/Merge on the same array size.