GCSE
Lesson 9 Coding sorting algorithms
In this lesson, learners will analyse and evaluate code for bubble sort and insertion sort in Python, as well as compare different implementations of the bubble sort algorithm. There are demo versions of bubble sort and insertion sort that output the steps of each pass which are linked in the “You may also need” section below, where you will also find the commented code used in the slides and worksheets and the 3 versions of bubble sort. Learners will first be presented with different statements referring to bubble sort and insertion sort where they have to work out whether they are true or false. The remaining slides demonstrate and explain a step-by-step Python implementation for each sorting algorithm, as well as two improvements to the bubble sort code. The slides for both the bubble sort and insertion sort in Python build up from the inside out, focussing first on how one pass is performed before adding the functionality to repeat this process. Each of the Python activities culminates with a worksheet that gets learners to further explore and understand the demoed code with questions and tracing the algorithm with a given set of data. Furthermore, a more efficient version of bubble sort is presented in a worksheet so learners can compare the efficiency of these two implementations.
Learning objectives
- Interpret the code for bubble sort and insertion sort
- Trace code for both sorting algorithms with input data
- Identify factors that could influence the efficiency of a bubble sort implementation
Package contents
- Lesson plans
- Learning graphs
- Unit overviews
- Activities
Not registered yet?
Create an account and get access to over 500 hours of free teaching resources.
GCSE revision
A comprehensive range of content and helpful practice questions are also available for this topic.