Skip to main content

Insertion Sort

Insertion sort builds an ordered section at the left end of a row. Each next item is lifted, then placed into the correct spot while larger items already in the ordered section shift one position right to open a gap.

In the picture

  1. A block already in its place in the growing ordered left section
  2. The open gap on the shelf where the lifted block will drop in
  3. The next block held above the row, ready to be inserted
  4. A taller block shifted one step right to make room
  5. A block at the right end still waiting to be processed

Examples

  • Sorting a hand of playing cards by sliding each new card into its place.
  • Putting books back on a shelf by inserting each book where it belongs.

Quiz: Insertion Sort (Age 16)

  1. During insertion sort, what happens to the next item as it is inserted into the ordered left section?

    • It is moved directly to the end of the unsorted right section without comparison.
    • It is swapped repeatedly with the item at the far right until it reaches the left end.
    • It is placed in its correct spot while larger items in that section shift one position right.
  2. After each insertion in insertion sort, what is true about the left part of the row?

    • It remains ordered.
    • It contains only the largest items from the row.
    • It becomes completely unsorted until the final step.
  3. According to the card, insertion sort works well for which kinds of lists?

    • Only very large lists in random order.
    • Only lists that are sorted in reverse order.
    • Small lists or lists that are already nearly ordered.

The answers, each with its explanation, are in the app. This lesson has left the free week, so its quiz is part of the subscription.

Get the app

Free app, optional subscription
App Store Google Play

Carry on in the app

At least one new illustrated lesson every weekday for your child’s year, with its quiz and a reminder at 6:15 pm.

Your child’s teacher does not use My Enhanced Teacher yet?

Tell them about it

Computer Science, Age 16