Algorithms and Decomposition
Algorithms and Decomposition
o Algorithmic thinking
o Decomposition
o Abstraction
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?
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.
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
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.