Insertion Sort

Domain: Algorithms

🎯 Motivation

Build a sorted portion one element at a time by inserting each new element into its correct position. Very fast for small or nearly-sorted data.

📋 Concrete Example

On [5, 3, 8, 1]: insert 3 before 5 -> [3, 5, 8, 1]. Insert 8 after 5 -> [3, 5, 8, 1]. Insert 1 at front -> [1, 3, 5, 8].

🔗 Analogy

Sorting a hand of playing cards. You pick up cards one by one and insert each into its correct position among the cards you already hold.