Algorithm design and
Problem-solving
Program development life
cycle
➜ Consists of four main stages
analysis
design
coding
Testing
Analysis
Before any problem can be solved, it needs to
be clearly defined and set out so anyone
working on the solution understands what is
needed.
Abstraction: Removal of unnecessary details
and identification of the key elements of the
problem
Decomposition: Breaking down a complex
problem into smaller, easier-to-solve parts
Identification of the problem and
requirements
Design
The program specification from the analysis
stage is used to show to how the program
should be developed
Pseudocode
Flowcharts
Structure diagrams
How the problem is to be solved, what tasks
are required for it and how they work with
each other, and the order of those tasks is
found out in this stage
Coding and iterative testing
Program code is written using a
programming language
Iterative testing of the separate modules of
the program is carried out, ensuring they
work as they are meant to
Most amendments to the code are carried out
in this stage
Testing
The completed program or set of programs is
run many times with different sets of test
data. This ensures that all the tasks
completed work together as specified in the
program design.
The completed program is tested with test
data to spot any errors
Computer systems
A computer system is made up of software,
data, hardware, communications and people;
each computer system can be divided up into a
set of sub-systems.
Each sub-system can be further divided into sub-
systems and so on until each sub-system just
performs a single action.
The alarm program is a very small computer
system but when you check the weather
forecast, you obtain the information you need
from one of the largest computer systems in the
world.
The computer system and its sub-
systems
In order to understand how a computer
system is built up and how it works it is often
divided up into sub-systems.
How each sub-routine works can be shown by
using flowcharts or Pseudocode
Top-down design is the decomposition of a
computer system into a set of subsystems,
then breaking each sub-system down into a
set of smaller sub-systems, until each sub-
system just performs a single action.
This is an effective way of designing a computer
system to provide a solution to a problem, since
each part of the problem is broken down into
smaller more manageable problems.
The process of breaking down into smaller sub-
systems is called stepwise refinement.
When larger computer systems are being
developed this means that several programmers
can work independently to develop and test
different sub-systems for the same system at the
same time. This reduces the development
and testing time.
Decomposing a problem
Any problem that uses a computer system for its
solution needs to be decomposed into its component
parts. The component parts of any computer system
are:
inputs – the data used by the system that needs to be
entered while the system is active
processes – the tasks that need to be performed
using the input data and any other previously stored
data
outputs – information that needs to be displayed or
printed for the users of the system
storage – data that needs to be stored in files on an
appropriate medium for use in the future
Methods used to design and
construct a solution to a problem
Solutions to problems need to be designed
using thorough methods, to ensure that their
purpose is clearly understood.
The use of formal methods enables the process
to be clearly shown for others to understand
the proposed solution. The following methods
need to be used by IGCSE Computer Science
students:
» structure diagrams
» flowcharts
» pseudocode.
Structure diagrams
Structure diagrams can be used to show top-
down design in a diagrammatic form.
Structure diagrams are hierarchical,
showing how a computer system solution can
be divided into sub-systems with each level
giving a more detailed breakdown. If
necessary, each sub-system can be further
divided.
Flowcharts
A flowchart shows diagrammatically the
steps required to complete a task and the
order that they are to be performed. These
steps, together with the order, are called an
algorithm.
Flowcharts are an effective way to
communicate how the algorithm that makes
up a system or sub-system works.
Process:
Process flowchart symbols are used to show
actions, for example, when values are assigned to
variables.
Input and output:
The same flowchart symbol is used to show the input
of data and output of information.
Decision:
Decision flowchart symbols are used to decide
which action is to be taken next; these can be used
for selection and repetition/iteration. There are
always two outputs from a decision flowchart symbol.
Flow lines:
Flowchart flow lines use arrows to show the
direction of flow, which is usually, but not
always, top to bottom and left to right.