GCSE
Lesson 7 Bubble sort
This lesson introduces learners to the first sorting algorithm in this unit, bubble sort. They will discuss why and where sorting is used in real life, become familiar with performing a bubble sort on a set of data, and investigate the efficiency of bubble sort. The sample data used in these worksheets and most of the other sorting algorithm worksheets is words instead of numbers as learners can often make mistakes when comparing if one word is higher or lower than another word. This will allow them plenty of practice in case they have to do this in an exam. Some learners can find writing the alphabet out helpful. The essence of sorting data is to make searching easier and this idea should frame the narrative of all the sorting lessons. They will start by performing a single pass first so they become used to the crux of the algorithm before doing multiple passes. By the end of the lesson learners should be able to execute a full bubble sort on a sample of data. They should also be aware that this algorithm is too slow for real world applications. It is, however, a good algorithm for introducing sorting algorithms and should be seen as a stepping stone to other sorting algorithms that perform better on large sets of data. Learners will also investigate a few ways to improve the efficiency of the algorithm, such as stopping if no swaps are made on a single pass and reducing the number of comparisons by one after each pass. This can result in the bubble sort algorithm being a viable option in some cases, for instance small sets of data that are nearly sorted.
Learning objectives
- Identify why computers often need to sort data
- Traverse a list of items, swapping the items that are out of order
- Perform a bubble sort to order a list containing sample data
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.