How do the bubble sort and merge sort algorithms put a list in order, and how do they compare?
The bubble sort and merge sort algorithms, how each puts a list into order, and how their efficiency on large lists compares.
An Eduqas GCSE Computer Science answer on the bubble sort and merge sort algorithms: how each orders a list step by step, a worked bubble-sort pass, and how their efficiency on large lists compares.
Reviewed by: AI editorial process; not yet individually human-reviewed
Have a quick question? Jump to the Q&A page
What this dot point is asking
Eduqas wants you to describe the bubble sort and the merge sort, explain how each puts a list in order, and compare their efficiency on large lists. The key marks are the "compare adjacent pairs and swap" idea for bubble sort, the "split and merge" idea for merge sort, and the contrast that merge sort is far faster on large lists.
Bubble sort
Merge sort
When to choose each sort
For a very small list, bubble sort is fine and is simpler to write, so the extra complexity of merge sort is not worth it. For a large list, the difference is dramatic: bubble sort's many passes make it slow, while merge sort's divide-and-merge approach keeps the number of comparisons manageable, so merge sort is the clear choice. If memory is very limited, bubble sort uses almost no extra space, whereas merge sort needs room for the parts being merged, which is one situation where bubble sort can still be preferred.
Try this
Q1. State what a bubble sort does when it compares two adjacent items that are in the wrong order. [1 mark]
- Cue. It swaps them.
Q2. State when a bubble sort knows the list is sorted. [1 mark]
- Cue. When a complete pass makes no swaps.
Q3. State one reason merge sort is preferred over bubble sort for a large list. [1 mark]
- Cue. It is much faster (it splits and merges, doing far fewer comparisons than bubble sort's many passes).
Exam-style practice questions
Practice questions written in the style of WJEC Eduqas exam questions on this dot point, with worked answer explainers. The year tag is the paper they imitate, not the source.
Eduqas Component 1, 20224 marksDescribe how a bubble sort puts a list of numbers into ascending order.Show worked answer →
Go through the list comparing each pair of adjacent items (up to 2 marks): if a pair is in the wrong order (the left larger than the right), swap them. This is one pass, and the largest unsorted value moves to the end.
Repeat the passes (up to 2 marks): after each pass the next largest value is in place, so repeat until a pass makes no swaps, meaning the list is sorted.
Markers reward "compare adjacent pairs and swap if out of order" and "repeat passes until no swaps". Saying it compares the first and last items misses the adjacent-pair point.
Eduqas Component 1, 20234 marksCompare bubble sort and merge sort for sorting a very large list, giving one advantage of each.Show worked answer →
Bubble sort advantage (up to 2): simple to understand and write, and uses little extra memory; fine for very small lists.
Merge sort advantage (up to 2): much faster on large lists because it repeatedly splits the list in half and merges sorted parts, doing far fewer comparisons than bubble sort's many passes.
To compare: bubble sort is slow on large lists (it makes many passes of adjacent swaps) but simple; merge sort is efficient on large lists (divide and merge) but more complex and uses more memory. Markers reward an advantage tied to each and the efficiency contrast.
Related dot points
- Computational thinking: abstraction, decomposition and algorithmic thinking, and how these techniques are used to break down and solve a problem.
An Eduqas GCSE Computer Science answer on computational thinking: abstraction (removing unnecessary detail), decomposition (breaking a problem into smaller parts) and algorithmic thinking (working out the steps), with a worked example of applying all three.
- Designing, expressing and tracing algorithms using pseudocode and flowcharts, and using a trace table to follow an algorithm step by step.
An Eduqas GCSE Computer Science answer on designing and expressing algorithms in pseudocode and flowcharts, the standard flowchart symbols, and using a trace table to follow an algorithm step by step and find its output.
- The linear search and binary search algorithms, how each works, the requirement that binary search needs sorted data, and how their efficiency compares.
An Eduqas GCSE Computer Science answer on the linear and binary search algorithms: how each works step by step, why binary search needs sorted data, and how their efficiency compares.
- The three programming constructs: sequence, selection (if and nested if) and iteration (count-controlled and condition-controlled loops), and when to use each.
An Eduqas GCSE Computer Science answer on the three programming constructs: sequence, selection (if, else, nested if) and iteration (count-controlled for loops and condition-controlled while loops), with worked pseudocode for each.
- Arrays as a data structure: declaring and using one-dimensional arrays, accessing elements by index, and iterating through an array with a loop, with awareness of two-dimensional arrays.
An Eduqas GCSE Computer Science answer on arrays as a data structure: declaring and using one-dimensional arrays, accessing elements by index, iterating through an array with a loop, and awareness of two-dimensional arrays.
Sources & how we know this
- WJEC Eduqas GCSE Computer Science specification (from 2016) — Eduqas (2020)