Decomposition Examples in CS Thinking

Start with the recap, study the fully worked examples, then use the practice problems to check your understanding of Decomposition.

This page combines explanation, solved examples, and follow-up practice so you can move from recognition to confident problem-solving in CS Thinking.

Concept Recap

Breaking a complex problem into smaller, independently-solvable parts that combine into a complete solution.

Eating an elephant: one bite at a time. Big problems become many small ones.

Read the full concept explanation โ†’

How to Use These Examples

  • Read the first worked example with the solution open so the structure is clear.
  • Try the practice problems before revealing each solution.
  • Use the related concepts and background knowledge badges if you feel stuck.

What to Focus On

Core idea: Solve each small independent part, then combine the solutions into a complete answer.

Common stuck point: The parts must be truly independent or have clear dependencies.

Sense of Study hint: To decompose a problem, first identify the major tasks or components involved. Then ask for each part: can this be solved on its own? If a part is still too complex, decompose it further. Finally, determine how the solved parts connect back together.

Common Mistakes to Watch For

Before you work through the examples, skim the mistake guide so you know which shortcuts and sign errors to avoid.

Worked Examples

Example 1

easy
You need to plan a school sports day. Decompose this problem into smaller sub-problems.

Solution

  1. 1
    Step 1: Identify the major areas: events/activities, equipment, scheduling, participants, venue.
  2. 2
    Step 2: Break each area down further โ€” e.g., Events: choose sports, set rules, assign referees. Scheduling: set times, allocate fields, plan breaks.
  3. 3
    Step 3: Each sub-problem is now small enough to tackle individually.

Answer

Sub-problems: choose events, organise equipment, create schedule, register participants, prepare venue, plan prizes.
Decomposition breaks a complex problem into smaller, manageable parts. Each part can be solved independently, making the overall problem less overwhelming.

Example 2

medium
Decompose the task of building a simple calculator program.

Practice Problems

Try these problems on your own first, then open the solution to compare your method.

Example 1

easy
Decompose the problem of creating a sandwich into at least 4 sub-tasks.

Example 2

medium
Decompose building a class voting app into four modules, and identify one dependency between them.