Step-by-Step Lesson

Learn: Insertion Sort - How It Works

OCR GCSE J277 Computer Science specification

Ready to start this lesson?

Sign in to track your progress. 14 steps including 7 interactive questions.

Sign In to Start Learning
14 Steps7 Questions

Students also studied

Browse all

Steps in this lesson (14)

1
Text

Welcome!Welcome back! You've already learned about bubble sort and how it works to sort data step-by-step. Today, we'll build on that knowledge and explore insertion sort, another method for arranging data in order.

2
Text

What is Insertion Sort?Insertion sort is a simple sorting algorithm that builds a sorted list one item at a time. It compares each item with those already sorted and inserts it into its correct position.This is useful when you need to sort small data sets or when data is almost sorted.

3
Text

How Does Insertion Sort Work?Insertion sort works by dividing the list into two parts: the sorted section and the unsorted section. Items from the unsorted section are moved into the correct position in the sorted section one by one.The process repeats until all items are sorted.

4
Multiple ChoiceInteractive

Which of the following describes insertion sort?

Start the lesson to answer this multiple choice question

5
Text

Key Steps of Insertion Sort1. Start with the first item in the list. This is considered sorted.2. Take the next item from the unsorted section and compare it to items in the sorted section.3. Shift larger items to the right and insert the new item into its correct position.4. Repeat until all items are sorted.

6
Text

Why Is It Called 'Insertion' Sort?The algorithm is called insertion sort because each item from the unsorted section is inserted into its correct position in the sorted section.

7
Fill in the BlankInteractive

Insertion sort works by dividing the list into a {{blank0}} section and an {{blank1}} section.

Start the lesson to answer this fill in the blank question

8
Text

Step-by-Step ExampleLet's look at how insertion sort works on a sample list: [8, 3, 5, 1]. We'll sort this in ascending order.

9
MatchingInteractive

Match the items on the left with their correct pairs on the right

Start the lesson to answer this matching question

10
Text

Review Time!Great work! You've learned how insertion sort works. Let's review the key points with a few questions.

11
Multi-SelectInteractive

Which of the following statements about insertion sort are true? (Select all that apply)

Start the lesson to answer this multi-select question

12
Fill in the BlankInteractive

Insertion sort moves an item to its {{blank0}} position in the sorted section by comparing it with {{blank1}} items.

Start the lesson to answer this fill in the blank question

13
Multiple ChoiceInteractive

Which of these is NOT a characteristic of insertion sort?

Start the lesson to answer this multiple choice question

14
Math EquationInteractive

Match the items on the left with their correct pairs on the right

Start the lesson to answer this math equation question

Genie

Want to Learn More?

Get personalised lessons, quizzes, and instant feedback from your AI tutor.

Explore More Topics