Skip to main content
WalesComputer ScienceSyllabus dot point

How do the bubble sort and merge sort algorithms put data into order, and how do they compare?

The bubble sort and merge sort algorithms, how each puts data into order, and the relative efficiency of the two methods.

A focused answer to the WJEC GCSE Computer Science Unit 1 content on sorting algorithms, covering how the bubble sort works by repeatedly swapping adjacent items, how the merge sort works by splitting and merging, and the relative efficiency of the two methods with worked examples.

Generated by Claude Opus 4.89 min answer

Reviewed by: AI editorial process; not yet individually human-reviewed

Have a quick question? Jump to the Q&A page

Jump to a section
  1. What this topic is asking
  2. Bubble sort
  3. Merge sort
  4. How the two compare for efficiency
  5. Choosing a sort
  6. Try this

What this topic is asking

WJEC wants you to know how the bubble sort and merge sort algorithms put data into order and how they compare for efficiency. This is part of the Algorithms and programming principles content in Unit 1 of WJEC GCSE Computer Science (3500).

Bubble sort

Merge sort

How the two compare for efficiency

Choosing a sort

A bubble sort is fine for small lists or when simplicity matters more than speed, and it is a good way to learn how sorting works. A merge sort is far better for large lists, where its faster growth in efficiency saves a lot of time despite its greater complexity and memory use. The right choice depends on the size of the data and whether speed or simplicity matters more, and on whether the extra memory a merge sort needs is available.

Try this

Q1. State what a bubble sort does when it finds an adjacent pair in the wrong order. [1 mark]

  • Cue. It swaps the two items.

Q2. State one advantage of a merge sort over a bubble sort. [1 mark]

  • Cue. It is much faster (more efficient) on large lists.

Exam-style practice questions

Practice questions written in the style of WJEC exam questions on this dot point, with worked answer explainers. The year tag is the paper they imitate, not the source.

WJEC-style Unit 14 marksDescribe how a bubble sort puts a list of numbers into ascending order.
Show worked answer →

A Unit 1 algorithms question. A bubble sort works by comparing each pair of adjacent items in the list (1 mark). If a pair is in the wrong order (the left one is larger when sorting ascending), the two are swapped (1 mark). It makes repeated passes through the list, and after each pass the largest remaining value has "bubbled" to its correct place at the end (1 mark). The algorithm repeats until a complete pass is made with no swaps, meaning the list is sorted (1 mark). Markers reward comparing adjacent items, swapping out-of-order pairs and repeating passes until no swaps. A common error is to forget that several passes are needed, or to compare non-adjacent items.

WJEC-style Unit 13 marksExplain why a merge sort is usually more efficient than a bubble sort on a large list.
Show worked answer →

A Unit 1 comparison question. A merge sort uses a divide-and-conquer approach: it repeatedly splits the list into smaller and smaller parts until each part has one item, then merges the parts back together in order (1 mark). This means the number of operations grows much more slowly as the list size increases than for a bubble sort, which repeatedly compares adjacent items (1 mark). On a large list a merge sort therefore does far fewer comparisons and is much faster, although it is more complex to write and uses more memory (1 mark). Markers reward the split-and-merge method and the slower growth in operations on large lists. A common error is to say a bubble sort is faster because it is simpler, confusing simplicity with efficiency.

Related dot points

Sources & how we know this