Insertion Sort

Build sorted prefix one element at a time — like sorting a hand of cards.

Best: O(n) Worst: O(n²) Space: O(1) Stable Adaptive
slow fast
Sorted prefix
Current (inserting)
Shifting right
Unsorted
Step
0/0
Iteration i
0
Comparisons
0
Shifts
0

Algorithm Trace

Press Start to run.