Cambridge IGCSE Computer Science 0478
Data Representation
Data Transmission
Hardware
Software
The Internet and Its Uses
Automated and Emerging Technologies
Algorithm Design and Problem-Solving
Programming
Algorithm Design and Problem-Solving
Standard methods of solution
- 3 things to know
- Paper 2
Overview
Linear search, bubble sort, totalling, counting and finding the maximum, minimum and average, with pseudocode.
What you need to know
Answer each one before you reveal it.
How should the purpose of an algorithm be explained?
How does a bubble sort work?
Questions from this subtopic
Each one with the model answer underneath.
- 1
How should the purpose of an algorithm be explained?
Model answer
State what the algorithm achieves overall, then describe the processes it uses, such as its inputs, loops, decisions and outputs.
- 2
How does a linear search work?
Model answer
A linear search checks each item in a list in turn, starting from the first, until the item is found or the end of the list is reached.
- 3
Give one advantage and one disadvantage of a linear search.
Model answer
A linear search works on an unsorted list. A linear search is slow for a long list, because every item may need to be checked.
- 4
How does a bubble sort work?
Model answer
A bubble sort compares each pair of adjacent items and swaps them if they are in the wrong order. Passes through the list are repeated until a pass makes no swaps.
- 5
Show the list 5, 3, 8, 1 after each pass of a bubble sort into ascending order.
Model answer
After the first pass the list is 3, 5, 1, 8. After the second pass the list is 3, 1, 5, 8. After the third pass the list is 1, 3, 5, 8.
- 6
Why is a flag used in an efficient bubble sort?
Model answer
A flag records whether any swap was made during a pass. If no swap was made, the list is sorted and the algorithm stops early.
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 Algorithm Design and Problem-Solving, 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.