Library
Compare Mode
Compare two algorithms side by side.
This comparison slice overlays deterministic metrics, synchronized shared inputs, and local playback controls on top of the shared-family matchup, so compatible comparisons can move through both runs step by step.
Comparison Rules
Shared-family picks only. Shared inputs sync only when both algorithms expose the same safe controls.

Current pool

array renderer family

Shared sync profile

Array values

Shared Inputs
Editing this panel regenerates both bubble-sort and selection-sort with the same synchronized input subset.
Playback Parity
One local playback state drives both runs with the same cursor and speed, independent from the main algorithm-page store.
1.00x0 / 56idle
Quick Read
Bubble Sort vs Selection Sort

Step Stream

53 / 56

Left uses 3 fewer default steps

Complexity

O(n^2) / O(n^2)

Both default runs land on O(n^2) time and O(1) space summaries.

Category

Sorting

array renderer family

What This Shows

Runs are generated from the same engine registry used by the main visualizer pages.

Metrics overlays expose shared observed counts like steps, comparisons, visits, edges, or nodes when both runs produce them.

Shared input sync keeps compatible pairs on the same array or grid configuration.

Playback parity now keeps both runs on the same cursor and speed without using the main app store.

Array and pathfinding pairs now reuse the same simple renderer surfaces inside compare mode.

Metrics Overlay
Shared observed metrics from both synchronized runs, normalized into one comparison board.

Input Size

Delta 0

8

even

8

Steps

Delta -3

53

right +

56

Comparisons

Delta 0

28

even

28

Swaps

Delta +12

17

left +

5

Passes

Delta 0

7

even

7

Left Algorithm
array
SortingPhase 1
Bubble Sort
Bubble Sort repeatedly compares neighboring numbers and swaps them until larger values bubble to the end.
Visualizer
SimpleBar Motion
Abstract bar-based playback for Bubble Sort, tuned for clean motion and short-form readability.
Ready0 / 538 bars
37
0
12
1
29
2
8
3
44
4
19
5
3
6
25
7
activecomparesettled

Active Step

Not started

0 / 53

Start playback or step forward to inspect the synchronized event stream.

Default Steps

53

Deterministic precomputed event count

Current Complexity

O(n^2)

O(n^2) on this input

Average Time

O(n^2)

n = 8

Space

O(1)

2 normalized params

Overlay Metrics

Input Size

8

Default input scale

Steps

53

Deterministic precomputed event count

Comparisons

28

Theoretical comparisons: best 7, worst 28

Swaps

17

Observed comparisons/swaps/passes: 28/17/7

Passes

7

Observed comparisons/swaps/passes: 28/17/7

Observed Notes

n = 8

optimizeEarlyExit = true

Input already sorted: false

Theoretical comparisons: best 7, worst 28

Open full visualizer
Right Algorithm
array
SortingPhase 1
Selection Sort
Selection Sort finds the smallest remaining value each pass and places it at the next sorted position.
Visualizer
SimpleBar Motion
Abstract bar-based playback for Selection Sort, tuned for clean motion and short-form readability.
Ready0 / 568 bars
37
0
12
1
29
2
8
3
44
4
19
5
3
6
25
7
activecomparesettled

Active Step

Not started

0 / 56

Start playback or step forward to inspect the synchronized event stream.

Default Steps

56

Deterministic precomputed event count

Current Complexity

O(n^2)

O(n^2) on this input

Average Time

O(n^2)

n = 8

Space

O(1)

2 normalized params

Overlay Metrics

Input Size

8

Default input scale

Steps

56

Deterministic precomputed event count

Comparisons

28

Theoretical comparisons (best/avg/worst): 28

Swaps

5

Theoretical swaps: best 0, worst 7

Passes

7

Observed comparisons/swaps/passes: 28/5/7

Observed Notes

n = 8

swapOnlyWhenNeeded = true

Theoretical comparisons (best/avg/worst): 28

Theoretical swaps: best 0, worst 7

Open full visualizer