Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
31 views19 pages

T2 Algorithms and Flowcharts

Uploaded by

cyj13824486226
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views19 pages

T2 Algorithms and Flowcharts

Uploaded by

cyj13824486226
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 19

Objectives

• Understand how flowcharts are used to solve


problems
• Understand flowchart symbols including:
• Processes, subroutines, input/output, decisions, terminators

• Create, interpret, correct, complete and amend


algorithms using flowcharts
Algorithms and flowcharts
Unit 8 Algorithm design and problem solving

Starter
• What is an algorithm?
Algorithms and flowcharts
Unit 8 Algorithm design and problem solving

Algorithms
• An algorithm is a set of instructions for
solving a problem or completing a task
• The task could be:
• Making a chocolate cake
• Summing the numbers 1 to 1000
• Building a Lego model

• One way of showing how an algorithm


works is to use a flowchart
Algorithms and flowcharts
Unit 8 Algorithm design and problem solving

Purpose Start

Add flour to
• Look at the flowchart bowl

• What is it a flowchart for?


Add water
• Describe the processes
involved in the algorithm
Mix

Too much Yes


flour? Add water

No

Too much Yes


water? Add flour

No

Knead dough Put in oven

Stop
Algorithms and flowcharts
Unit 8 Algorithm design and problem solving

Purpose Start

Add flour to
• It is a flowchart for bowl

making bread
Add water
• The flour and water are
mixed together
Mix
• If there is too much flour,
more water is added Yes
Too much
flour? Add water
• If there is too much water,
more flour is added No

Too much Yes


• Once correct, the dough water? Add flour
is kneaded No

• The dough is put in the oven Knead dough Put in oven


Too much
flour?
Stop
Algorithms and flowcharts
Unit 8 Algorithm design and problem solving

Writing algorithms
• Flowcharts are one way that shows how a problem
may be solved
• How many different flowchart symbols do you know?
• What do each of the symbols you know mean?

Start
Algorithms and flowcharts
Unit 8 Algorithm design and problem solving

Flowchart symbols

No
Terminal Input / Output Decision

Yes
Start
INPUT Grade

No
Is Count = 10?
Stop OUTPUT Total
Yes
Algorithms and flowcharts
Unit 8 Algorithm design and problem solving

Flowchart symbols

Process Sub program


Line
Shows direction of flow

count  count + 1 showMenu()

total  total + mark search("Jack")


Algorithms and flowcharts
Unit 8 Algorithm design and problem solving

Drawing a flowchart
• An algorithm is a series of Start
steps to solve a problem or
carry out a task OUTPUT
"Choose an ID"

• What algorithm does this


flowchart represent?
INPUT ID

Yes
Is this OUTPUT
ID already in "Choose
use? another ID"
No

Save(ID)

Stop
Algorithms and flowcharts
Unit 8 Algorithm design and problem solving

Counting
Start
• The algorithm shows how it is
possible to count using count  0
a flowchart
• The statement count  count + 1 count  count + 1
means “Add 1 to the variable called
count”
OUTPUT count
• Explain exactly what the program
will do?
Is count Yes
< 1000?

Is count < No
1000? Stop
Algorithms and flowcharts
Unit 8 Algorithm design and problem solving

Counting
Start
• The program outputs:
• 1 count  0

• 2
count  count + 1
• …
• 999
OUTPUT count

• Note that the program won’t output Is count Yes


0 or 1000 < 1000?
No

Stop
Algorithms and flowcharts
Unit 8 Algorithm design and problem solving

Worksheet 2
• Complete Task 1 and Task 2 on Worksheet 2
Algorithms and flowcharts
Unit 8 Algorithm design and problem solving

Finding the maximum


• The flowchart shows Start
the algorithm that will
find the maximum of INPUT num1

two numbers
INPUT num2
• Remember when using
a decision symbol that
you must label the different num1 Yes
branches that come out > OUTPUT num1
num2
of it – in this case
No
“Yes” and “No”
OUTPUT num2

Stop
Algorithms and flowcharts
Unit 8 Algorithm design and problem solving

Sub programs
• Sub programs are used when you wish to call
another procedure or function
• They use a box
with lines either side Start
findVAT(n)
• In this example,
findVAT is called INPUT total VAT  n * 0.2
from the
sub program box total  total + Return VAT
• The findVAT sub findVAT(total)
program then runs
OUTPUT
and returns the total
answer to where
it was called Stop
total = total + count
Algorithms and flowcharts
Unit 8 Algorithm design and problem solving

Worksheet 2
• Complete Task 3, Task 4 and Task 5
on Worksheet 2
Algorithms and flowcharts
Unit 8 Algorithm design and problem solving

Plenary
• What are each of the following symbols?
• Explain to a partner what each one does
Algorithms and flowcharts
Unit 8 Algorithm design and problem solving

Plenary
• What are each of the following symbols?
• Explain to a partner what each one does

Decision –
Input / Output change flow
based on a
Process – Maths decision
operations and
assignment of variables
Sub program –
Line – shows call a different
direction of flow function or
procedure
Terminal – for
start and stop
Algorithms and flowcharts
Unit 8 Algorithm design and problem solving

Copyright

© 2024 PG Online Limited

The contents of this unit are protected by copyright.

This unit and all the worksheets, PowerPoint presentations, teaching guides and other associated files
distributed with it are supplied to you by PG Online Limited under licence and may be used and copied by you
only in accordance with the terms of the licence. Except as expressly permitted by the licence, no part of the
materials distributed with this unit may be used, reproduced, stored in a retrieval system, or transmitted, in any
form or by any means, electronic or otherwise, without the prior written permission of PG Online Limited.

Licence agreement

This is a legal agreement between you, the end user, and PG Online Limited. This unit and all the worksheets,
PowerPoint presentations, teaching guides and other associated files distributed with it is licensed, not sold, to
you by PG Online Limited for use under the terms of the licence.

The materials distributed with this unit may be freely copied and used by members of a single institution on a
single site only. You are not permitted to share in any way any of the materials or part of the materials with any
third party, including users on another site or individuals who are members of a separate institution. You
acknowledge that the materials must remain with you, the licencing institution, and no part of the materials may
be transferred to another institution. You also agree not to procure, authorise, encourage, facilitate or enable any
third party to reproduce these materials in whole or in part without the prior permission of PG Online Limited.

You might also like