Title: Algorithms
1Algorithms
2WHAT IS AN ALGORITHM?
- It is a set of instructions of how to carry out a
process. An algorithm lists the steps that must
be followed to complete the process and to reach
the solution
3Examples of algorithms
- A knitting pattern
- A set of instructions telling you how to put a
kit together (eg. an IKEA kitchen unit) - A recipe in a cook book
- An algorithm can be represented diagrammatically
in the form of a flow chart.
4A flow chart
- A flowchart consists of a sequence of
instructions linked together by arrows to show
the order in which the instructions must be
carried out. - It provides detailed steps.
- Each instruction is put into a box. The boxes are
different shapes depending upon what the
instruction is.
5Process shapes
Remember not to create the flow chart in
WORD Instead do this in POWER POINT and
change File Page Layout to PORTRAIT Autoshapes
has the shapes you need to use
Input or output
START / END
Query / question
Human process i.e. you doing something!
No
Yes
Printed output
Save to file
6More shapes
- You can also use the following shapes
- Predefined process
- Used for a sequence of instructions which is
defined somewhere else (eg. in a subroutine) - Connector
- to link with a different page or another part
of the program -
- (Note all these shapes can be found under
AutoShapes - if you click the Drawing icon on your tool bar)
Predefined process
7TASK 1 MAKING A CUP OF TEA!
- The following list represents the steps needed in
order to make a cup of tea. Put the list in the
right order and produce an algorithm in
POWERPOINT showing the processes and decisions
you need to make.
- Take tea bag out of cup
- Boil the water
- Put tea bag in cup
- Add milk?
- Pour boiling water in cup
- Fill kettle
- Stir
- Ready
- Add sugar ?
- Fetch cup
Answers follow
8The answers
START
Fill kettle
- Fill kettle
- Boil the water
- Fetch cup
- Put tea bag in cup
- Pour boiling water in cup
- Take tea bag out of cup
- Add sugar ?
- Stir
- Add milk?
- Stir
- Ready
Boil the water
Fetch cup
Put tea bag in cup
Pour boiling water in cup
Take tea bag out of cup
Add sugar ?
N
Stir in sugar
Add milk?
N
Now add the shapes
Pour in milk
Ready
9Skills in Powerpoint to create your algorithm.
To change this to .
To tidy up the whole column select all (drag
around all shapes) Go to DRAW Select ALIGN or
DISTRIBUTE
10START
Fill kettle
Boil the water
To this but take care as it can mess up the
side sections!
Fetch cup
Put tea bag in cup
Pour boiling water in cup
Take tea bag out of cup
Add sugar ?
N
Stir in sugar
Add milk?
N
Ready
Pour in milk
11TASK 2A PREDEFINED PROCESS
- In order to carry out no. 8 in the list above,
you will need to instruct the user how to fill a
kettle. - (a) Produce a set of instructions called Filling
a kettle and then - (b) update your algorithm for task 1 to include
this predefined process.
12TASK 3MAKING A CUP OF COFFEE!
- How would your algorithm change for making a cup
of coffee instead of tea? Amend your algorithm in
Task 2 (b) in order to produce a new diagram.
13Now try to create one on a PC
- This should always be done in POWERPOINT..
- NEVER, EVER, EVER in WORD!