Solid sorting comparison

Same blocks. Different algorithms.

One original collection is shown on two parallel shelves. Insertion sort works in place on the front shelf; merge sort stages records in the visibly labeled temporary buffer behind the rear shelf. Every record keeps a unique identity mark.

Insertion · comparisons
0
Value-to-value key comparisons
Insertion · data moves
0
Shifts and key-placement writes
Merge · comparisons
0
Value-to-value key comparisons
Merge · data moves
0
Temporary writes included
ONE INPUT · TWO ALGORITHMS
Drag to orbit · wheel to zoom · double-click to reset the camera
A checkpoint is a teaching state, not a fixed unit of work. Playback speed is not a complexity measurement.
Front shelf · insertion sort 0 comparisons · 0 moves this step
Original arrangement

Both algorithms begin with the exact same eight blocks in the exact same order.

Rear shelf · merge sort 0 comparisons · 0 moves this step
Original arrangement

The temporary rack begins empty. Temporary writes appear when a segment is staged.

Published counting convention

Comparison: one comparison of two block values. Ties are still compared. Loop-bound checks, reads, and identity checks are not comparisons.

Data move: one write of one block record into an array slot. An in-place overwrite counts once, even when it rewrites the same index. Holding the insertion key in a local variable is not a move.

Temporary storage is included: every write into the merge temporary buffer counts as one move, and every write from that buffer back to the shelf counts again. Reads are never moves.

Both algorithms are stable: equal-valued blocks retain their original relative order.

Checkpoints intentionally contain different amounts of primitive work. One insertion checkpoint is one outer pass; one merge checkpoint is one completed segment merge. Neither the checkpoint count nor animation speed should be interpreted as a complexity benchmark.

Primitive operation ledger

The expandable ledger shows the exact primitive comparisons and writes represented by the current visual checkpoint.

Show operations for this checkpoint

Insertion sort

    Merge sort