What is the difference between an algorithm and a program?
Based on: AQA 8525 · 3.1.1
Section 3.1 is examined on Paper 1, and it is examined by doing. You will be asked to trace an algorithm by hand, say what it does, or compare two ways of solving the same problem. The facts below are the ones the doing depends on. If any of them is shaky, the long questions will find it.
What is the difference between an algorithm and a program?
Based on: AQA 8525 · 3.1.1
In a flowchart, which shape is used for a decision?
Based on: AQA 8525 · 3.1.2
Which condition must be true before a binary search can be used?
Based on: AQA 8525 · 3.1.3
What does decomposition mean when solving a problem?
Based on: AQA 8525 · 3.1.1
These are the mistakes the topic notes single out.
An algorithm is a sequence of steps that solves a problem. A program is that sequence written in a language a computer can run. The same algorithm can be coded in Python, C# or VB.NET and it is still the same algorithm. Two skills sit underneath this. Decomposition breaks a problem into smaller sub-problems that can be solved on their own. Abstraction removes the detail that does not matter so you can concentrate on what does. A timetable app that ignores the colour of each train is using abstraction, because the colour has no bearing on when the train departs.
Structured English, pseudo-code and flowcharts. Pseudo-code is not a real language and does not have to run. Questions are often set in AQA's pseudo-code, so you need to read it fluently even though you may answer in any clear and sensible format. A flowchart uses fixed shapes joined by arrows, and a decision diamond has one arrow out for each possible answer. Tracing an algorithm, also called a dry run, means working through it by hand and writing each variable's value after every line in a trace table. If the question gives you input values, use exactly those.
A linear search checks each item in turn from the start until it finds the target or runs out of items. It works on unordered data. A binary search looks at the middle item and, if that is not the target, throws away the half the target cannot be in. It only works on data that is already sorted. On large lists binary search is much faster, because each comparison halves what is left. A linear search on 1,000 items may need 1,000 comparisons. A binary search needs at most about 10. On a very short list, or on data that would have to be sorted first, a linear search can still win.
A bubble sort passes through the list repeatedly, comparing neighbouring pairs and swapping them if they are the wrong way round. After the first pass the largest value is in its final place. It can stop early if a whole pass makes no swaps, because that means the list is already sorted. A merge sort splits the list in half over and over until every part holds one item, then merges pairs of parts back together in order. Merge sort is faster than bubble sort on large lists. It needs extra memory to hold the parts while merging, so bubble sort can be preferred when memory is tight and the list is small.
Efficiency is about how the time or memory an algorithm needs grows as the amount of data grows. It is not about how fast one particular computer is. Two algorithms can produce the same output and still differ in efficiency. When a question asks you to compare them it wants the number of steps or comparisons, not a preference. Standard algorithms are worth memorising as patterns: find the maximum, find the minimum, count how many items match a condition, and total or average an array.
| Linear search | Binary search |
|---|---|
| Checks each item in turn from the start. | Checks the middle item and discards the half the target cannot be in. |
| Works on unordered data. | Only works on data that is already sorted. |
| On 1,000 items it may need 1,000 comparisons. | On 1,000 items it needs at most about 10. |
| Can win on a very short list or on data that would have to be sorted first. | Wins on large sorted lists because each comparison halves what is left. |
No. It only works on data that is already sorted. On unsorted data it can discard the half that holds the target. Stating that the data must be sorted is often worth a mark on its own.
Decomposition breaks a problem into smaller sub-problems that can be solved separately. Abstraction removes detail that does not affect the problem. They are different skills and the exam tests whether you can tell them apart.
No. After one pass only the largest value is guaranteed to be in its final place. The sort keeps passing until a whole pass makes no swaps.
It is faster than bubble sort on large lists, but it needs extra memory to hold the parts while merging. When memory is tight and the list is small, bubble sort can be preferred.
Describe the purpose in one sentence, for example it finds the largest value in the array. A line by line retelling of the code is the answer examiners see most and reward least.
RiverMap Learning apps are independent study tools. They are not affiliated with, endorsed by, or connected to any government body or examination authority. Question content is original and based on publicly available official study materials.