Comparisons

Insertion Sort vs Selection Sort

Updated June 8, 2026 5 min read

Insertion Sort vs Selection Sort compares two simple O(n²) algorithms with very different personalities. Insertion Sort is adaptive and stable; Selection Sort is neither, but it makes the fewest swaps of any sort. The right choice depends on whether reads or writes dominate your cost.

The key differences

PropertyInsertion SortSelection Sort
Best caseO(n)O(n²)
AdaptiveYesNo
StableYesNo
SwapsUp to O(n²)Exactly n-1

When to choose each

Choose Insertion Sort almost always — it is adaptive, stable, and fast on small or nearly-sorted data. Choose Selection Sort only when writes are extremely expensive (such as flash memory wear), because it guarantees the minimum number of swaps.

Frequently asked questions

Which is better, Insertion Sort or Selection Sort? +
Insertion Sort is better for most cases — it is adaptive (O(n) on sorted data) and stable. Selection Sort only wins when minimizing the number of writes is the priority.
Why does Selection Sort make fewer swaps? +
It finds the minimum and performs just one swap per pass, totaling n-1 swaps. Insertion Sort may shift many elements per insertion, doing more writes.

See it in motion

Watch this algorithm and 9 others run step by step in our free interactive visualizer.

▶ Launch Visualiser

Related articles

← Back to all articles