Menu
Coddy logo textTech

How it works?

Lesson 3 of 9 in Coddy's Insertion Sort - DSA Series course.

Imagine you have a deck of cards, and your task is to arrange them in ascending order. Insertion Sort is like sorting these cards one by one.

Step-by-Step Process:

  1. Picking Cards:
    • Start with the first card (or the first element in our array).
    • Think of it as the sorted part; the rest is unsorted.
  2. Sorting Cards:
    • Pick the next card (element) from the unsorted part.
    • Compare it with the cards in the sorted part, finding its correct spot.
    • Shift larger cards to make room for the new one.
  3. Insert in Place:
    • Insert the card in its correct spot in the sorted part.
    • Repeat this process for each card in the deck (each element in the array).
quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

Conclusion:

Insertion Sort is like sorting your cards – taking one at a time, finding its place among the already sorted ones. Simple, isn't it? In the next lesson, we'll see how to turn this understanding into code.

Try it yourself

This lesson doesn't include a code challenge.

All lessons in Insertion Sort - DSA Series