Professional Documents
Culture Documents
Activity 1
What is this an example of and why are
they important?
It is of course a recipe
What is an algorithm?
Algorithms and Flowcharts
Learning Algorithms
Objectives:
(a) understand algorithms
(written in pseudocode or
flow diagram), explain what • In general, an 'algorithm' is the
they do, and correct or
complete them name given to a set of steps
(b) produce algorithms in
pseudocode or flow needed to complete a task.
diagrams to solve problems.
Algorithm
Algorithms
are
independent
of any
language
Algorithms and Flowcharts
Learning
Objectives:
(a) understand algorithms
(written in pseudocode or
flow diagram), explain what
they do, and correct or
What is an algorithm?
Activity 2
• In your own words, write down the steps
needed to solve the following problem.
There are therefore methods used to write algorithms so that they are
succinct, accurate and easy to understand so that a programmer of any
language could understand the steps required to solve a task:
Examples of
each method of
algorithm
writing
Algorithms and Flowcharts
Learning Flowcharts
Objectives: Today we will focus on Flowcharts
(a) understand algorithms
(written in pseudocode or • Visual representation of a system
flow diagram), explain what
they do, and correct or • Small number of symbols used to represent
complete them individual steps
(b) produce algorithms in
pseudocode or flow • Arrows show the flow of control within the
diagrams to solve problems. algorithm (the order of instructions)
• Easier to trace a sequence of steps and locate
errors than in pseudocode.
Start Example:
A central heating system will try to
keep the temperature between 2
Is Yes
temp
Turn heating values (19 and 21)
on
< 19 - If the temperature falls below 19 It
No will turn the heating system on
Is Yes Turn heating
- If the temperature rises above 21
temp off it will switch the heating system
> 21
off.
No
Algorithms and Flowcharts
Learning
Objectives: Start and Stop Symbols
(a) understand algorithms
(written in pseudocode or
flow diagram), explain what All flow charts begin with a Start Symbol and at the
they do, and correct or end of the flow chart (or at various end points of
complete them
(b) produce algorithms in the chart) we place a Stop Symbol.
pseudocode or flow
diagrams to solve problems.
There are drawn as a rectangle with curved ends
Flowcharts Start
and their
symbols
Stop
Algorithms and Flowcharts
Learning
Objectives: Process Symbols
(a) understand algorithms
(written in pseudocode or
flow diagram), explain what Most of the time a flow chart will demonstrate the
they do, and correct or sequence of instructions to be carried out.
complete them
(b) produce algorithms in
pseudocode or flow Simple processes (like “Add 1 to x” or “append x to
diagrams to solve problems.
List”) are shown using a standard rectangle.
Flowcharts Add 1 to x
and their
symbols Append x
to “List”
Algorithms and Flowcharts
Learning
Objectives: Input / Output Symbols
(a) understand algorithms
(written in pseudocode or
flow diagram), explain what At times your program will most certainly ask the
they do, and correct or user for inputs and output values too.
complete them
(b) produce algorithms in
pseudocode or flow Inputs and Outputs (like “Name?” or “…display
diagrams to solve problems.
age”) are shown using a parallelogram.
Name?
Flowcharts
and their Store in variable
“Name”
symbols
Display
Name
Algorithms and Flowcharts
Learning
Objectives: Decision Symbols
(a) understand algorithms
(written in pseudocode or
flow diagram), explain what At times your program will be programmed to
they do, and correct or make a decision based on certain conditions.
complete them
(b) produce algorithms in
pseudocode or flow Decisions (like “IF X = 3” or “While Y > 3”) are shown
diagrams to solve problems.
using a diamond.
Flowcharts If X = 3
Yes
Display “X
equals 3”
and their
symbols No
Display “X
doesn’t
equal 3”
Algorithms and Flowcharts
Learning
Objectives:
(a) understand algorithms
(written in pseudocode or
flow diagram), explain what
they do, and correct or
complete them
(b) produce algorithms in
pseudocode or flow
diagrams to solve problems.
Flowcharts
and their
symbols
Algorithms and Flowcharts
Learning
Objectives:
(a) understand algorithms
(written in pseudocode or
flow diagram), explain what
they do, and correct or
complete them
(b) produce algorithms in
pseudocode or flow
diagrams to solve problems.
Flowcharts
and their
symbols
Algorithms and Flowcharts
Learning
Objectives:
4 things you need to be able
(a) understand algorithms
(written in pseudocode or
to do with algorithms for your
flow diagram), explain what
they do, and correct or exam
complete them
(b) produce algorithms in
pseudocode or flow • Understand them
diagrams to solve problems.
• Correct them if they have
errors,
• Complete them if they are
incomplete
• Produce them after being
given a problem to solve
Algorithms and Flowcharts
Learning
Objectives:
Tips on reading algorithms.
(a) understand algorithms
(written in pseudocode or
flow diagram), explain what
• Start from top and
they do, and correct or follow the arrows
complete them
(b) produce algorithms in
• Remember what the
pseudocode or flow symbols mean
diagrams to solve problems.
• Read each symbol
description
• Logically work out
what the algorithms
is doing.
X = 10
No
while Yes
X < 10
X=X+1 Or it might be a
No
loop which you
cannot get into or
End perhaps out of.
Algorithms and Flowcharts
Learning
Objectives:
Tips on completing
(a) understand algorithms
(written in pseudocode or algorithms. • Start from top and follow
flow diagram), explain what the arrows
they do, and correct or
complete them • Remember what the
(b) produce algorithms in symbols mean
pseudocode or flow
diagrams to solve problems. • Read each symbol
description
• Logically work out what the
algorithms is doing.
THEN,
• Use your knowledge
of the algorithm so far
• AND Use your
knowledge of the
follow chart symbols
• …and complete the
flowchart
Algorithms and Flowcharts
Learning
Objectives:
Tips on writing algorithms.
(a) understand algorithms
(written in pseudocode or
flow diagram), explain what
they do, and correct or
complete them
(b) produce algorithms in
pseudocode or flow
diagrams to solve problems.
Activity 3
• Make notes explaining what an
algorithm is, what a flowchart is and the
flowchart symbols for:
– start / stop
– input / output
– processes
– Decisions