Year 10

Year 10

# Coding sorting algorithms

## Lesson details

### Key learning points

1. In this lesson, we will analyse and evaluate code for bubble sort and insertion sort in Python, as well as comparing different implementations of the bubble sort algorithm.

### Licence

This content is made available by Oak National Academy Limited and its partners and licensed under Oak’s terms & conditions (Collection 1), except where otherwise stated.

## Video

Share with pupils

## Worksheet

Share with pupils

## Starter quiz

Share with pupils

### 7 Questions

Q1.
"The insertion sort algorithm works by grouping the items in a list into two parts: a sorted sublist and an unsorted sublist."
False
Q2.
"With each pass through the list, an item from the unsorted sublist is compared to items in the sorted sublist until it is inserted into the correct position."
False
Q3.
"If the item at the current position is greater than value, copy it into the next item and move on to the previous item in the list"
False
Q4.
"Insertion sort compares an item from the unsorted sublist with the items in the sorted sublist and places it in the correct position."
False
Q5.
"Insertion sort is usually slower to execute than bubble sort on large, unordered data sets."
True
Q6.
"Insertion sort is usually slower to execute than bubble sort on large, unordered data sets."
True
Q7.
"During a pass of an insertion sort, elements in the sorted part of the list are copied into the next position, to make space for the value to be inserted."
False

## Exit quiz

Share with pupils

### 9 Questions

Q1.
'A more efficient version of bubble sort uses a variable to flag when a swap was made during a single pass'
False
Q2.
'The insertion sort algorithm copies the value to be inserted in a variable at the end of each pass'
True
Q3.
'During a pass of an insertion sort, elements in the sorted part of the list are copied into the next position, to make space for the value to be inserted'
False
Q4.
Two improvements to the bubble sort algorithm are reducing the number of comparisons after each pass, and stopping once no swaps are made during a single pass.
False
Q5.
"Bubble sort compares items next to each other in the list and swaps them if they are in the wrong order."
False
Q6.
"Insertion sort compares an item from the unsorted sublist with the items in the sorted sublist and places it in the correct position."
False