
Let’s think it through · Start with a story
The robot has to run a scoring contest: collect scores, find the winner, and print certificates. The girl breaks the job into small tasks that can be checked one by one.
Break down the process
- CollectCheck that scores are valid
- CalculateFind the highest score
- Handle tiesChoose the winners according to the rules
- PresentOutput the list
Breaking a problem down gives each step clear inputs and outputs.
Together, the subtasks still have to cover the original problem. For example, splitting the work must not make you forget to handle ties.
01Why break a problem down?
A big problem can be hard to think through all at once, but many big problems consist of several simpler tasks.
02Break it down into steps
For example: “Read scores and output the name of the student with the highest score.”
- Read the data.
- Find the highest score.
- Record the student associated with it.
- Output the answer.
03Break it down into subproblems
This is common in recursion and dynamic programming:
Factorials, range problems, and tree structures are often approached this way.
04Solve a simplified version first
If the original problem is complicated, start by asking:
- What if n were only 5?
- What if we only needed to decide “whether any exist” rather than find the best answer?
- What if one of the special constraints were removed?
A simplified version often makes the core structure easier to see.
05Is smaller always better?
No.
If each tiny subproblem depends on many outside details, breaking things down too far can make their relationships more confusing.
06How do you know if the breakdown makes sense?
Clear responsibilities
What does each part solve?
Clear interfaces
What input does it need, and what result does it produce?
Combinable results
Can the smaller answers be combined into the final answer?
What you have learned
- A complex problem can be broken into simpler subtasks.
- You can break it down by steps, states, or smaller subproblems.
- Solving a simplified version first can reveal the core pattern.
- Breaking a problem into pieces that are too small can add complexity.
- A good breakdown has clear responsibilities, clear inputs and outputs, and parts that can be combined.
Next: Why Start with the Simplest Case?
Your turn
If a function that finds the winner returns 2, how will the display function know whether that means second place, index 2, or a score of 2?
Have an answer? Click to see the explanation
Agree on what the return value means and how items are numbered. Use a clear name or structure to represent it.