Edexcel IGCSE Computer Science 4CP0
Algorithms
Searching and Sorting Algorithms
Decomposition and Abstraction
Developing and Testing Code
Programming Constructs and Operators
Data Types and Data Structures
Input, Output and Validation
Data Representation
Data Storage and Compression
Encryption
Hardware and the CPU
Software
Programming Languages and Translators
Networks
Network Security
The Internet and the World Wide Web
Emerging Trends, Issues and Impact
Searching and Sorting Algorithms
Merge sort
- 3 things to know
- Papers 1 and 2
Overview
How a merge sort splits a list into single items and merges them in order, a worked example, and when it beats a bubble sort.
What you need to know
Answer each one before you reveal it.
How does a merge sort work?
Why is a list of one item already sorted?
Questions from this subtopic
Each one with the model answer underneath.
- 1
How does a merge sort work?
Model answer
A merge sort splits the list in half repeatedly until each part holds one item. The parts are then merged back together in order.
- 2
Why is a list of one item already sorted?
Model answer
A single item has nothing to be compared with, so it is in order by definition. The merge sort builds sorted lists from these single items.
- 3
How are two sorted lists merged?
Model answer
The first items of each list are compared and the smaller is moved to the new list. The comparison repeats until both lists are empty.
- 4
Show how a merge sort orders 6, 3, 8, 1.
Model answer
The list splits into 6, 3 and 8, 1, then into single items. Pairs merge into 3, 6 and 1, 8. The final merge gives 1, 3, 6, 8.
- 5
Give one advantage and one disadvantage of a merge sort.
Model answer
A merge sort is much faster than a bubble sort on large lists. A merge sort needs extra memory to hold the split lists and is harder to code.
- 6
Which sorting algorithm suits a list of a million items, and why?
Model answer
A merge sort is the best choice for a million items. The number of comparisons grows far more slowly than in a bubble sort.
Other ways to work this
The same content, four other ways.
Everything in your subscription
Runs, plus a mode for every other kind of session.
Every question in Searching and Sorting Algorithms, on a schedule.
Learn it in runs of four questions, each ending on a brain dump against the clock. Every question you lock in comes back the next day, then at longer gaps, each time just before you would forget it.
Or £46 a year, about £3.83 a month. Cancel anytime.