Evaluating algorithms and test data
Two algorithms can solve the same problem but one may be far quicker or use far less memory. Good test data proves an algorithm really works.
Measuring efficiency
Linear search on n items: up to n comparisons.
Binary search halves the list each time, so it needs far fewer comparisons on large sorted lists.
Merge sort is faster than bubble sort on big lists but needs extra memory for the sub-lists.
Test data
| Type | Meaning | Example for a mark from 0 to 100 |
|---|---|---|
| Normal | Typical valid data that should be accepted | 56 |
| Boundary | Valid data at the very edge of the range | 0 and 100 |
| Erroneous | Invalid data that should be rejected | "ten" or 150 |
Fitness for purpose
Use logical reasoning: trace it with normal, boundary and erroneous data and compare with the expected results.
How many comparisons does a binary search make to find 31 in [3, 8, 12, 19, 24, 31, 40]?
- Middle item is 19. 31 > 19, so keep the right half [24, 31, 40].
- Middle of that half is 31. Found.
Answer: 2 comparisons
Efficiency is judged by comparisons, loop passes and memory. Test with normal, boundary and erroneous data. Binary search beats linear search on big sorted lists; merge sort is fast but uses more memory.
- Algorithm
- A precise sequence of steps to solve a problem.
- Erroneous data
- Invalid test data that should be rejected.
- Binary
- Base 2: the number system that uses only the digits 0 and 1.
- Binary search
- Repeatedly checks the middle item of a sorted list and discards half the list.
- Linear search
- Checks each item in turn from the start of a list until the target is found or the list ends.
- Merge sort
- Splits a list into single items, then merges pairs of lists back together in order.
All GCSE and International GCSE Computer Science key terms and definitions โ
- Not โ15โ. 15 is normal data.
- Not โ"sixteen"โ. Text is erroneous data.
- Not โ25โ. 25 is erroneous: outside the range.
Try two quick questions
See if it has sunk in. Answers are marked straight away.
2 more questions
Try each one, then tap to check.
What is the maximum number of comparisons a linear search makes on a list of 80 items?
Show the answer
Answer: 80
In the worst case the item is last or missing, so every item is checked: 80 comparisons.
How many comparisons does a binary search (middle item, rounding down) make to find 40 in [3, 8, 12, 19, 24, 31, 40]?
Show the answer
Answer: 3
Middle items checked: 19, 31, 40. That is 3 comparisons.
Check you have got it
Answer 7 quick questions with instant marking. If you get one wrong, GCSE-ready shows you why and gives you another go. It is free, and you do not need an account.
- Pearson Edexcel GCSE Computer Science (1CP2) specification, topic 1.2.7, 6.1.6
- Pearson Edexcel International GCSE Computer Science (4CP0) specification, topic 1.1.7, 1.1.9, 2.1.4, 2.1.7
Facts checked against the sources below, 17 October 2026. Last updated 2 October 2026. Spotted a mistake? Tell us and we will fix it.
What do exam command words like explain and evaluate mean? โ