Back to Sorting Algorithms

Oak National Academy

Lessons written by expert teachers in England, each with slides, a video and quizzes.

Their topic:
Searching and sorting algorithms
For your topic:
Sorting Algorithms · Computer Science - 9210

Use these lessons alongside our lesson note, which covers your syllabus in full.

What this covers in your syllabus

2 lessons from Oak National Academy

Lesson 1 of 2 · GCSE level, ages 14 to 16

Bubble sort

By the end: I can perform a bubble sort to order data in a list.

Key learning points

  1. The bubble sort algorithm works by repeatedly going through a list.
  2. It compares adjacent items and swaps the items if they are in the wrong order.
  3. Each time the algorithm goes through the list it is called a pass.
  4. The pass through the list is repeated until no more changes are made on a pass.

Keywords

bubble sort
a sorting algorithm that repeatedly compares pairs of values within a list and swaps them if they are out of order
pass
a complete traversal of a list

A common mistake

Mistake: The bubble sort algorithm stops on the last swap.

In fact: The pass through the list is repeated until no more changes are made on a pass. The last pass is needed to confirm the data is in order.

Check what you learned

From Oak National Academy's exit quiz. Choose every answer that is right.

What does the bubble sort algorithm do?
What is the purpose of swapping items in the bubble sort algorithm?
How many passes are required to complete a bubble sort?

A computing lesson by Oak National Academy licensed under the Open Government Licence (OGL) v3.0. Read the licence

Lesson 2 of 2 · GCSE level, ages 14 to 16

Merge sort

By the end: I can perform a merge sort to order a list.

Key learning points

  1. Merge sort splits items in lists into individual lists before merging pairs of lists together till all items are sorted.
  2. Merge sort is an efficient “divide and conquer” algorithm that can perform well in real world use.
  3. A merge sort algorithm is usually faster to execute but more complex to write than bubble sort.
  4. Executing a merge sort takes up extra space in memory.

Keywords

merge sort
a sorting algorithm that works by repeatedly splitting data into sublists and merging pairs of sublists, ordering the items as they are merged
splitting
the initial step of dividing an unsorted list into smaller sublists
merging
the process of combining two already sorted lists into a single, larger sorted list

A common mistake

Mistake: Merge sort is the most efficient sorting algorithm for all cases.

In fact: For smaller data sets, simpler algorithms such as insertion sort or bubble sort can be faster due to the overhead in merge sort of having to break apart the data to be sorted.

Check what you learned

From Oak National Academy's exit quiz. Choose every answer that is right.

What is the first step in a merge sort?
What is the purpose of merging in merge sort?
What is one disadvantage of merge sort?
Which is faster for smaller data sets: merge sort or bubble sort?

A computing lesson by Oak National Academy licensed under the Open Government Licence (OGL) v3.0. Read the licence

The wording comes from each publisher. The layout and the links to your syllabus are ours.