Describe and use decomposition

9.1 Computational Thinking Skills: Decomposition

What is Decomposition?

🧩 Decomposition is like breaking a big LEGO set into smaller, manageable parts. Instead of trying to build the whole castle at once, you first build the walls, then the towers, and finally the roof. In programming, we split a complex problem into simpler sub‑problems that can be solved independently and then combined to solve the whole problem.

Why Use Decomposition?

✏️ Decomposition helps you:

  • Reduce complexity – easier to understand and debug.
  • Reuse solutions – sub‑problems can become reusable functions.
  • Parallelise work – different team members can tackle different parts.
  • Plan better – you can estimate time and resources for each part.

Steps to Decompose a Problem

  1. Read the problem carefully and identify the main goal.
  2. Ask “What are the sub‑tasks needed to achieve this goal?”
  3. Write each sub‑task as a separate, self‑contained problem.
  4. Determine the order in which sub‑tasks must be executed.
  5. Check if any sub‑task can be further broken down.
  6. Translate each sub‑task into an algorithm or function.
  7. Combine the sub‑tasks to form the complete solution.

Example: Calculating the Average of a List

Suppose we need to find the average of a list of numbers. We can decompose this into three clear steps:

Step Description Pseudo‑code
1. Sum the numbers Add all elements in the list. sum = 0
for each x in list:
  sum = sum + x
2. Count the numbers Determine how many elements there are. count = length of list
3. Divide sum by count Compute the average. average = sum / count

The mathematical formula for the average is: $$\text{average} = \frac{\sum_{i=1}^{n} x_i}{n}$$

Exam Tips

🔍 When answering decomposition questions:

  • Show the hierarchy clearly – use bullet points or numbered lists.
  • Label each sub‑problem with a short, descriptive title.
  • Explain the order of execution and why it matters.
  • Use diagrams or tables if they help illustrate the flow.
  • Remember to mention that each sub‑problem can be turned into a function or method.

Quick Recap

🧠 Decomposition = Breaking a big problem into smaller, manageable parts. 🔧 Steps: Identify goal → list sub‑tasks → order them → write algorithms → combine. 📚 Practice by taking any real‑world task (e.g., planning a party) and writing out the sub‑tasks. 💡 In exams, show clear structure and explain the reasoning behind each step.

Revision

Log in to practice.

2 views 0 suggestions