Algorithmic Problem-Solving Guides: Breaking Complex Problems Into Smaller Steps (Copy)
Breaking Complex Problems Into Smaller Steps
What This Skill Means In Algorithmic Problem Solving
- Complex problems:
- Look overwhelming at first glance
- Usually contain multiple tasks hidden together
- This skill is about:
- Splitting one big problem into manageable sub-problems
- Solving each part independently
- Combining them into one correct algorithm
- Examiners test this heavily in:
- Long algorithm questions
- Scenario-based questions
- “Design an algorithm” tasks
Core Examiner Rule (Critical)
- No marks for panic solutions
- Marks are awarded for:
- Clear decomposition
- Logical sequencing
- Step-by-step structure
- Big problems are never solved in one jump
Why Breaking Problems Down Matters
- Prevents:
- Missed conditions
- Wrong loop choice
- Overcomplicated logic
- Makes it easier to:
- Debug
- Trace
- Explain answers in exams
The 6-Step Decomposition Method (Exam-Proven)
Step 1: Restate The Problem In One Simple Sentence
- Remove story
- Remove detail
- Capture the core task
Example
Original Problem
“Input marks for 30 students, calculate the average of marks above 50, and display whether the class performance is good or poor.”
Restated
- Process 30 marks
- Consider only marks > 50
- Calculate average
- Display a message
Step 2: Identify Sub-Tasks Explicitly
Break the problem into actions, not code.
Example Sub-Tasks
- Input marks
- Check if mark > 50
- Add valid marks
- Count valid marks
- Calculate average
- Display result
Step 3: Map Each Sub-Task To A Programming Concept
| Sub-Task | Concept |
|---|---|
| Repeated input | Loop |
| Condition checking | IF |
| Adding values | Accumulator |
| Counting items | Counter |
| Final decision | IF / ELSE |
| Display result | OUTPUT |
Written and Compiled By Sir Hunain Zia (AYLOTI), World Record Holder With 154 Total A Grades, 7 Distinctions and 11 World Records For Educate A Change AS Level Computer Science Full Scale Course
Step 4: Decide The Correct Order Of Execution
- Order matters
- Some steps depend on others
Correct Logical Order
- Initialise counters and totals
- Loop for repeated input
- Apply condition
- Update totals and counters
- Perform final calculation
- Output result
Step 5: Write A Skeleton Algorithm (No Detail Yet)
Skeleton Example
<initialise variables>
FOR each item
INPUT value
IF condition met THEN
update totals
ENDIF
NEXT
calculate result
OUTPUT result
- Skeleton ensures:
- Nothing is forgotten
- Structure is examiner-friendly
Step 6: Refine Each Step Into Final Pseudocode
- Add:
- Exact conditions
- Variable names
- Loop limits
Fully Worked Example 1: Student Performance Analysis
Problem
“Input marks for 20 students, calculate the average of marks above 60, and display ‘Good’ if the average exceeds 75.”
Decomposition
| Step | Task |
|---|---|
| 1 | Input marks |
| 2 | Filter marks > 60 |
| 3 | Add valid marks |
| 4 | Count valid marks |
| 5 | Calculate average |
| 6 | Decide output |
Pseudocode
total ← 0
count ← 0
FOR i ← 1 TO 20
INPUT mark
IF mark > 60 THEN
total ← total + mark
count ← count + 1
ENDIF
NEXT i
IF count > 0 THEN
average ← total / count
IF average > 75 THEN
OUTPUT "Good"
ELSE
OUTPUT "Poor"
ENDIF
ENDIF
Written and Compiled By Sir Hunain Zia (AYLOTI), World Record Holder With 154 Total A Grades, 7 Distinctions and 11 World Records For Educate A Change AS Level Computer Science Full Scale Course
Fully Worked Example 2: Multi-Condition Real-World Problem
Problem
“A factory records temperatures every hour for 24 hours and reports if any temperature exceeds 90.”
Decomposition
- Input temperature
- Repeat 24 times
- Compare with limit
- Stop early if exceeded
- Output result
Pseudocode
exceeded ← FALSE
hour ← 1
WHILE hour <= 24 AND exceeded = FALSE DO
INPUT temp
IF temp > 90 THEN
exceeded ← TRUE
ELSE
hour ← hour + 1
ENDIF
ENDWHILE
IF exceeded = TRUE THEN
OUTPUT "Limit Exceeded"
ELSE
OUTPUT "Safe"
ENDIF
Breaking Down Problems With Multiple Outputs
Example
“Input 15 numbers, display the largest number and how many numbers are even.”
Sub-Tasks
- Track maximum
- Check even
- Count evens
Pseudocode
countEven ← 0
INPUT num
max ← num
IF num MOD 2 = 0 THEN
countEven ← 1
ENDIF
FOR i ← 2 TO 15
INPUT num
IF num > max THEN
max ← num
ENDIF
IF num MOD 2 = 0 THEN
countEven ← countEven + 1
ENDIF
NEXT i
OUTPUT max
OUTPUT countEven
Written and Compiled By Sir Hunain Zia (AYLOTI), World Record Holder With 154 Total A Grades, 7 Distinctions and 11 World Records For Educate A Change AS Level Computer Science Full Scale Course
How Decomposition Helps With Debugging
- Each sub-task can be:
- Traced independently
- Checked for correctness
- Errors are easier to locate:
- “Counting wrong” vs “Input wrong”
Common Student Mistakes In Breaking Problems Down
Mistake 1: Trying To Solve Everything At Once
- Leads to:
- Messy logic
- Missed steps
Mistake 2: Mixing Tasks Together
- Input, processing, and output tangled in one block
Mistake 3: Forgetting Edge Cases
- Example:
- No valid values
- Division by zero
Examiner Signals That You Decomposed Correctly
- Clear initialisation
- Logical sequencing
- No missing conditions
- Readable structure
- Easy traceability
Decomposition Checklist (Use Before Final Answer)
- Can I list all sub-tasks as bullets?
- Does each sub-task map to a structure?
- Is the order logically correct?
- Are all results eventually output?
- Is the solution simpler than the original problem?
Exam-Ready Decomposition Template
<initialise variables>
FOR / WHILE
INPUT
IF condition
PROCESS
ENDIF
END LOOP
FINAL CALCULATION
OUTPUT
Written and Compiled By Sir Hunain Zia (AYLOTI), World Record Holder With 154 Total A Grades, 7 Distinctions and 11 World Records For Educate A Change AS Level Computer Science Full Scale Course
One-Line Rules To Memorise
- Big problems are collections of small ones
- Solve one step at a time
- Order matters
- Structure beats cleverness
- Clear steps earn marks
