Cambridge Lower Secondary CheckpointStage 9

Computational Thinking

Computing Stage 9 Chapter Notes

What this chapter covers

Computational Thinking
ShareWhatsAppPost
Computational Thinking notes

Unable to load PDF

The notes viewer could not load. Please refresh the page.

Read online free. Download a watermarked copy with a free account.

Read the notes

The full Computational Thinking notes as text: skim, search, and jump between subtopics.

~10 min read

1. What is Computational Thinking?

Computational Thinking (CT) is a problem-solving methodology. It is not about thinking like a computer, but rather a set of skills that humans use to solve complex problems in a way that a computer could then execute. It involves breaking down large problems, finding patterns, focusing on what's important, and designing step-by-step solutions. These skills are fundamental not just in computer science, but in many other fields like science, engineering, and even everyday life.

Key term

Computational Thinking: A problem-solving process that involves breaking down a complex problem into simpler parts and creating a step-by-step solution that a computer or human can execute.

Worked example 14 marks

Explain how you would use the four main components of computational thinking to plan a school trip for your year group.

  1. 1
    1. Decomposition: Break the large task of 'planning a school trip' into smaller, manageable sub-tasks. These include: choosing a destination, arranging transport, collecting money, getting parental consent, creating a schedule for the day, and arranging food.
  2. 2
    1. Pattern Recognition: Identify patterns to simplify tasks. For example, the process of collecting a consent form and payment from one student is the same for all students. This pattern allows you to create a single efficient process for everyone.
  3. 3
    1. Abstraction: Focus on essential details and ignore irrelevant ones. Essential details include the total number of students, the budget per student, and dietary requirements. Irrelevant details for the initial planning phase might include what each student will wear or who they will sit with on the bus.
  4. 4
    1. Algorithm Design: Create a step-by-step plan (an algorithm) for the entire process. This would be a timeline of actions, such as: Step 1: Finalise destination and cost. Step 2: Send out letters to parents. Step 3: Set a deadline for forms and payment. Step 4: Book the coach and venue based on final numbers.

Recap

  • Computational thinking is a method for solving complex problems.
  • It is a fundamental skill for computer science and many other areas.
  • The four cornerstones of computational thinking are Decomposition, Pattern Recognition, Abstraction, and Algorithms.
  • It enables you to formulate a problem in a way that a machine can help solve it.

Quick check

  1. List the four main components of computational thinking.2 marks

2. Decomposition: Breaking Down Problems

Decomposition is the first step in computational thinking. It is the process of breaking down a complex problem or system into smaller, more manageable, and understandable parts. Each of these smaller parts can then be examined and solved individually. By solving all the sub-problems, you will have solved the overall complex problem. Think of it like assembling flat-pack furniture; you don't build the whole wardrobe at once, you follow instructions to build smaller components (drawers, doors, frame) and then combine them.

Key term

Decomposition: The process of breaking down a complex problem or system into smaller, more manageable sub-problems.

Common pitfall

Students often stop decomposing too early, leaving sub-problems that are still too complex to be solved easily.

Worked example 15 marks

You have been asked to create a simple 'Hangman' game. Use decomposition to break this problem down into at least five smaller sub-problems.

  1. 1

    The problem 'create a Hangman game' can be decomposed into the following sub-problems:

  2. 2
    1. Word Selection: Create a mechanism to choose a secret word from a predefined list.
  3. 3
    1. Display: Set up the game display, showing underscores for each letter of the secret word and the hangman structure.
  4. 4
    1. User Input: Create a way for the user to guess a letter.
  5. 5
    1. Guess Checking: Check if the guessed letter is in the secret word. If it is, reveal the letter's position(s). If not, add a part to the hangman drawing.
  6. 6
    1. Win/Loss Condition: Determine if the game has been won (the word is fully guessed) or lost (the hangman is complete) and display an appropriate message.

Recap

  • Decomposition involves breaking a large problem into smaller parts.
  • The smaller parts are called sub-problems.
  • Each sub-problem should be easier to solve than the original large problem.
  • Solving all the sub-problems leads to a solution for the overall problem.
  • Decomposition makes complex tasks less daunting and easier to manage.

Quick check

  1. Why is decomposition a useful first step in solving a complex problem?1 mark

3. Pattern Recognition: Finding Similarities

After decomposing a problem, the next step is often to look for patterns. Pattern recognition involves identifying trends, similarities, or repeated sequences among the sub-problems or within the data. Recognizing these patterns can make the problem easier to solve. For example, if you find that several sub-problems are very similar, you can create a single solution that can be applied to all of them. This makes the overall solution simpler, more efficient, and less prone to errors.

Key term

Pattern Recognition: The process of identifying trends, similarities, or repeated sequences within a problem or dataset to simplify a solution.

Examiner insight

Marks are often awarded for identifying how a recognized pattern can lead to a more elegant and efficient solution, such as using a single function with parameters instead of writing the same code multiple times.

Fun fact

The CAPTCHA tests ('I am not a robot') that ask you to identify objects in images work by using computers that have been trained through pattern recognition to identify those objects themselves.

Worked example 14 marks

In a program that draws a picket fence made of 50 identical posts, explain how pattern recognition helps simplify the code.

  1. 1
    1. Decomposition: The problem is to draw a fence. This can be broken down into drawing 50 individual posts and the gaps between them.
  2. 2
    1. Pattern Recognition: You would recognise that all 50 picket posts are identical. They have the same shape, size, and colour. The process of 'drawing one post' is a pattern that is repeated 50 times.
  3. 3
    1. Simplification: Instead of writing the code to draw a post 50 separate times, you can write the code once (perhaps as a function or procedure).
  4. 4
    1. Implementation: You can then use a loop to call this single piece of code 50 times, slightly changing the position for each post. This makes the program much shorter, easier to write, and easier to debug.

Recap

  • Pattern recognition is about finding similarities or things that repeat.
  • It is often applied after decomposing a problem.
  • Identifying patterns allows for the creation of more efficient, reusable solutions.
  • A common way to implement a pattern in programming is by using loops or functions.

Quick check

  1. How does recognizing patterns help in creating a more efficient computer program?2 marks

4. Abstraction: Focusing on the Essentials

Abstraction is the process of filtering out—or ignoring—the characteristics and details that we don't need in order to concentrate on those that we do. It's about creating a simplified representation of a problem. A great example is a map for a public transport system. It shows the stations, the lines connecting them, and where they intersect. It abstracts away all the complex details of the actual roads, buildings, and parks above ground, because that information is not essential for travelling on the network. In computer science, abstraction helps us manage complexity by hiding complicated details behind a simple interface.

Key term

Abstraction: The process of removing unnecessary detail from a problem to focus on the essential characteristics.

Common pitfall

A common mistake is confusing abstraction with decomposition. Decomposition breaks a problem down; abstraction simplifies it by removing detail.

Worked example 16 marks

You are creating a computer simulation of a car. Using abstraction, identify three essential details you would need to include and three non-essential details you could ignore.

  1. 1

    The goal is to simulate the car's behaviour, not create a perfect replica.

  2. 2
    1. Essential Details: To simulate a car, you need to model its core functions. Essential details would include: a) Speed: The current speed of the car. b) Direction/Steering: The direction the car is travelling. c) Fuel Level: How much fuel is remaining, which affects how long it can run.
  3. 3
    1. Non-Essential Details (Abstraction): To simplify the model, we can ignore details that don't affect the basic simulation. These could include: a) Colour of the car: This has no impact on its movement. b) The material of the seats: This is irrelevant to the car's performance in a simulation. c) The brand of the tyres: Unless the simulation is highly advanced and models friction, this is unnecessary detail.

Recap

  • Abstraction is about simplifying complexity by hiding unnecessary details.
  • It involves creating a model of a problem that includes only relevant information.
  • The London Underground map is a classic example of abstraction.
  • In programming, using a function is a form of abstraction; you know what it does, but not necessarily how it does it.
  • Abstraction helps to make systems easier to understand and use.

Quick check

  1. Give an example of a detail you might abstract away when creating a character for a video game.1 mark

5. Algorithms: Step-by-Step Solutions

An algorithm is the final part of the computational thinking process. It is a finite, ordered set of unambiguous, executable steps that defines a terminating process. In simpler terms, it's a step-by-step recipe for solving a problem or completing a task. Once you have decomposed a problem, recognised patterns, and abstracted away irrelevant details, you design an algorithm to solve each of the remaining sub-problems. Algorithms can be expressed in various ways, most commonly using flowcharts (a diagrammatic representation) or pseudocode (a structured, text-based description).

Key term

Algorithm: A precise, step-by-step set of instructions or rules designed to perform a specific task or solve a particular problem.

Examiner insight

Examiners look for algorithms that are logical, cover all possible conditions (e.g., using IF/ELSE), and are written in a clear, standard format, whether pseudocode or flowchart.

Worked example 14 marks

Write a pseudocode algorithm that asks a user for their age and then outputs either 'You are old enough to vote.' if they are 18 or over, or 'You are not old enough to vote.' if they are under 18.

  1. 1
    1. INPUT age
  2. 2
    1. IF age >= 18 THEN
  3. 3
    1. OUTPUT 'You are old enough to vote.'
  4. 4
    1. ELSE
  5. 5
    1. OUTPUT 'You are not old enough to vote.'
  6. 6
    1. ENDIF

Worked example 23 marks

Describe an algorithm for making a piece of toast.

  1. 1
    1. START
  2. 2
    1. Take one slice of bread from the bag.
  3. 3
    1. Place the slice of bread in a toaster slot.
  4. 4
    1. Set the toaster to the desired level.
  5. 5
    1. Push down the lever to begin toasting.
  6. 6
    1. WAIT for the toast to pop up.
  7. 7
    1. Remove the toast from the toaster.
  8. 8
    1. END

Recap

  • An algorithm is a step-by-step plan for solving a problem.
  • Each step in an algorithm must be clear and unambiguous.
  • An algorithm must have a clear stopping point.
  • Algorithms are commonly represented using pseudocode or flowcharts.
  • Developing an algorithm is the final stage of the computational thinking process.

Quick check

  1. What are the two most common ways to represent an algorithm?2 marks

End-of-chapter exercise

Test yourself on the whole chapter. Work through these before moving on.

  1. Define 'abstraction' and provide a real-world example not related to computing.2 marks
  2. List the four cornerstones of computational thinking and write a single sentence describing each one.4 marks
  3. You are designing a mobile app to help people learn a new language. Use decomposition to list four main features or modules the app would need.4 marks
  4. A program needs to calculate the final price for 100 different items in an online shop, each of which has a 10% discount applied. Explain how pattern recognition would be used to make this task efficient.4 marks
  5. Write a pseudocode algorithm that takes a number as input and outputs 'Positive' if it's greater than zero, 'Negative' if it's less than zero, and 'Zero' if it is zero.5 marks
  6. Explain the difference between decomposition and abstraction, using the example of planning a holiday to illustrate your answer.4 marks
  7. You are tasked with creating a program to find the average temperature from a list of daily temperatures recorded over a month. Apply all four principles of computational thinking to explain how you would approach this project.8 marks
  8. A 'linear search' algorithm finds an item in a list by checking each item one by one from the start until the item is found or the end of the list is reached. Write the pseudocode for a linear search algorithm.6 marks
  9. Consider the task of baking a cake from a recipe. Explain how this process is an example of an algorithm and how abstraction is used by the recipe writer.5 marks
  10. A student is creating a 2D game. They need to check if the player's character has collided with any of the 50 coins scattered around the level. How can they use decomposition and pattern recognition to solve this problem efficiently?6 marks

Go deeper

Practise and revise with member-only material for this chapter.

Free notes are just the start.

Unlock every Workbook and Chapter at a Glance, and generate your own worksheets and predicted papers.

Explore plans

Related chapters