0% found this document useful (0 votes)
25 views

Algorithms and Decomposition

The document discusses computational thinking principles including algorithms, decomposition, and abstraction. It provides examples of each, such as recipes for algorithms, breaking problems into smaller parts for decomposition, and focusing on important details while ignoring unnecessary ones for abstraction. Computer games are used to illustrate decomposition and abstraction. The document also covers flowcharts, pseudocode, and basic data types.

Uploaded by

alex.njoroge
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views

Algorithms and Decomposition

The document discusses computational thinking principles including algorithms, decomposition, and abstraction. It provides examples of each, such as recipes for algorithms, breaking problems into smaller parts for decomposition, and focusing on important details while ignoring unnecessary ones for abstraction. Computer games are used to illustrate decomposition and abstraction. The document also covers flowcharts, pseudocode, and basic data types.

Uploaded by

alex.njoroge
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Algorithms and Decomposition

LO: Understand principles of computational thinking

Solving problems that can be implemented by a computer system is known as computational


thinking

There are three main principles of computational thinking:

o Algorithmic thinking
o Decomposition
o Abstraction

What are algorithms?

 Algorithms are a set of step-by-step instructions in order to produce a solution to a


problem
 Algorithmic thinking requires the use of abstraction and decomposition to identify each
step
 Once each step has been identified, a precise set of rules (algorithm) can be created
and the problem will be solved
 An example of algorithmic thinking is following a recipe, if the recipe is
followed precisely it should lead to the desired outcome
 A set of traffic lights is an example of how algorithmic thinking can lead to solutions
being automated

Decomposition

What is decomposition?

 Decomposition is the process of breaking down a large problem into a set of smaller
problems
 Benefits of decomposition are:
o Smaller problems are easier to solve
o Each smaller problem can be solved independently of the others
o Smaller problems can be tested independently
o Smaller problems can be combined to produce a solution to the full problem
 An examples of decomposition in computing is:

Computer games

 Modern computer games are decomposed to break down the complexity of the
problem into more manageable 'chunks'
 Creating an entire game at once would be challenging and inefficient, so it could be
decomposed into:
o Levels - Levels can be designed/created/tested/ independently of other levels
o Characters - The mechanics of characters in the game can be designed and
created by a separate team
o Landscape - The art team can work on the visual aspects of the game without
needing to understand how the game is programmed
 Once all of the smaller problems are completed, joined together a complex game has
been created
What is abstraction?

 Abstraction is the process of removing unnecessary details of a problem to focus on


the important features to implement in a solution
 Examples of abstraction include modelling a real-life object, environment, action,
sequence of actions or concept.
 Implementations of these include:
o a computer game that simulates playing a sport
o a simulator such as a car or flight simulator,
o a map of a bus or train route in a city
 When creating a program, developers must identify important features that will
contribute to solving the problem or have a role to play in the solution

Computer games

 Computer games use a large amount of abstraction, removing the elements that a
user does not need to consider in order to enjoy playing the game
 When using abstraction in computer games which are designed to simulate real life, the
aim is to make the game realistic and visually appealing whilst keeping the game fun to
play
 In a game that simulates a sport, it is important to the user that visually they recognise
the environment and when they perform an action, they see a response
 However, users do not need to know the complex algorithms used to control the non-
player characters (NPCs)

Train map

 Another specific example of abstraction would be the London underground train route
map; travellers do not need to know the geographical layout of the routes, only that
getting on at stop A will eventually transport you to stop B

Worked example

Jack plays rugby at his local rugby club. He wants to create a program to store the results of
each rugby match they play and the names of the try scorers.

Define what is meant by abstraction [2]

Give one example of how abstraction could be used when developing this program [1]

Answer

 Abstraction is removing unnecessary detail from a problem in order to focus on the parts
of the problem that need solving
 Simplifies the problem // reduces complexity // easier to solve

Any suitable example of abstraction as long as it is relevant to the system

 Examples of what to ignore/hide/remove:


o Time the try was scored
o Player shirt number
o Venue
 Examples of parts to focus on:
o Player name
o Match result
o Tries scored

Program design tools – Simple flowcharts


Flowcharts
A flowchart represents an algorithm using symbols. The step-by-step process is shown with
lines, arrows, and boxes of different shapes demonstrating the flow of the process.

 Flow chart symbols


 Reading simple flowcharts

Program design tools – Simple Pseudo codes


Pseudocode
Pseudocode is an English-like description of the processing steps to be performed in a
program.

The programmer writes these descriptions in the order in which corresponding program
statements will appear in the program.

Although there are no standards for pseudocode, it usually uses structured programming control
structures.

Selection and sequence

Simple turtle graphics

Physical Health and safety

Health- Eyestrain, Headaches, RSI, back and neck pains

Physical Health and safety

Safety – Fires, electrocution, tripping and falling equipment

Program Data types, String, Char, number, Boolean

You might also like