← CS_basics
Visualizer
/
Insertion Sort
🌙
Insertion Sort
Insert each element into its correct position in the sorted portion. Fast for nearly sorted arrays.
Sorted
Key (inserting)
Shifting
Unsorted
Controls
Array size:
20
Speed
Run
Reset
Best: O(n) | Avg: O(n²) | Worst: O(n²) | Stable
Steps