🎉 October Learning Month — learn a new software term every day!
An interactive flashcard trainer for software engineering terms.

Insertion Sort

In plain terms

Builds a sorted list by inserting each item into its correct place.

Going deeper

Insertion sort takes elements one by one and inserts each into the growing sorted portion. It's efficient for small or nearly-sorted data.

Under the hood

O(nΒ²) worst case but O(n) on nearly-sorted input; stable and used as the base case inside hybrid sorts.

Examples

Small arrays, nearly-sorted data, the base case in Timsort/introsort.

Think of it like...

Like sorting a hand of cards by slotting each new card into its right spot.

Feedback & Bug Report