Use flowcharts, structure diagrams and pseudocode to construct a solution
🔍 Algorithm Design & Problem‑Solving – Cambridge IGCSE 0478
What is an Algorithm?
An algorithm is a step‑by‑step recipe that solves a problem or performs a task. Think of it like a cooking recipe: you follow the steps in order to get a tasty dish.
🗺️ Flowcharts
Why Use Flowcharts?
Flowcharts give a visual map of the algorithm. They help you spot mistakes before you write code.
🔹 Common Symbols:
- 🟢 Oval – Start/End
- 🟦 Rectangle – Process/Action
- 🔺 Diamond – Decision (Yes/No)
- ➡️ Arrow – Flow of control
🔹 Example: Find the Largest of Three Numbers
| Step | Flowchart Symbol | Description |
|---|---|---|
| 1 | 🟢 Start | Begin algorithm |
| 2 | 🟦 Input a, b, c | Read three numbers |
| 3 | 🔺 a > b? | Is a greater than b? |
| 4 | ➡️ Yes → 🔺 a > c? | If a > b, check a > c |
| 5 | ➡️ Yes → 🟦 Largest = a | a is largest |
| 6 | ➡️ No → 🟦 Largest = c | c is largest |
| 7 | ➡️ No → 🟦 Largest = b | b is largest |
| 8 | 🟢 End | Finish algorithm |
🧩 Structure Diagrams
What Are Structure Diagrams?
Structure diagrams show the hierarchy and relationships between different parts of an algorithm. They’re like a family tree for your code.
🔹 Example: Calculating the Average of Five Scores
| Component | Description |
|---|---|
| Input Module | Collects five scores from the user. |
| Processing Module | Adds the scores and divides by 5. |
| Output Module | Displays the average. |
✍️ Pseudocode
Why Pseudocode?
Pseudocode lets you write the algorithm in plain English (or your native language) without worrying about syntax. It’s the bridge between the flowchart and the actual code.
🔹 Example: Calculating the Largest of Three Numbers (Pseudocode)
START
INPUT a, b, c
IF a > b THEN
IF a > c THEN
largest ← a
ELSE
largest ← c
END IF
ELSE
IF b > c THEN
largest ← b
ELSE
largest ← c
END IF
END IF
OUTPUT largest
END
📚 Exam Tips & Tricks
1️⃣ Understand the Question
Read the problem carefully. Highlight keywords like “calculate”, “compare”, “loop”, and “output”.
2️⃣ Sketch a Flowchart First
Even a rough sketch helps you organise your thoughts and spot missing steps.
3️⃣ Use Clear Variable Names
Names like maxValue or totalScore make your pseudocode easier to read.
4️⃣ Check Edge Cases
What happens if two numbers are equal? Think about all possible inputs.
5️⃣ Practice, Practice, Practice
Try different problems: sorting lists, calculating factorials, or simulating a simple game.
🚀 Final Thought
Remember, an algorithm is like a well‑planned road trip: you need a map (flowchart), a route plan (structure diagram), and a travel guide (pseudocode) to reach your destination (the correct answer) smoothly. Keep practicing, and soon you’ll design algorithms as naturally as you write sentences!
Revision
Log in to practice.