How insertion sort works
Let us see how insertion sort works.
🧩 Imagine this:
You’re arranging your playing cards (or Pokémon cards!) in order — from smallest number to biggest.
⚙️ Step 1: Start small
You pick the first card — easy! It’s already “sorted” since it’s alone.
⚙️ Step 2: Take the next card
Now you take the next card from the pile. You look at the cards already in your hand and find where this new card should go — before, in the middle, or after them — to keep them in order.
You insert it in the right place (that’s why it’s called insertion sort!).
🔁 Step 3: Keep doing this
You keep taking one card at a time from the pile, and insert it into the correct spot among the cards you’ve already sorted.
Each time you do it, your “sorted hand” grows bigger and stays perfectly ordered.
🏁 Step 4: Done!
When you’ve gone through all your cards, the whole set is sorted neatly from smallest to biggest.
🌟 The idea:
Insertion sort is like how you sort your cards while playing — you don’t throw them all on the floor and start over; you build up the order one by one.