Insertion Sort Visualizer

Insertion Sort is a simple sorting algorithm that builds the final sorted array one item at a time by repeatedly picking the next element and inserting it into its correct position.

Try It Yourself

Adjust the array size and animation speed to see how Insertion Sort performs on different data sets.

Comparison with Other Sorting Algorithms

AlgorithmBest CaseAverage CaseWorst CaseSpaceStable
Bubble SortO(n)O(n²)O(n²)O(1)Yes
Quick SortO(n log n)O(n log n)O(n²)O(log n)No
Merge SortO(n log n)O(n log n)O(n log n)O(n)Yes
Insertion SortO(n)O(n²)O(n²)O(1)Yes
Selection SortO(n²)O(n²)O(n²)O(1)No
Heap SortO(n log n)O(n log n)O(n log n)O(1)No