Introduction To Algorithm
Introduction To Algorithm
1
Starter activity
Five sticks
Nina has five sticks. She puts them on the table and creates this shape:
Amica comes to the table. She takes one stick and puts it in a different place:
Then Attaliya comes to the table, she also takes one stick and puts it in a different
place.
Question:
Which shape is Attaliya not able to make?
A B C D
Think, write, pair, share 2
Starter activity
Five sticks
Answer:
The answer is D.
Explanation:
A B C D
3
Algorithm
Objectives
1. Narrative
2. Pseudocode
3. Flowchart
12
Algorithm – representing algorithm using
narrative
Narrative
manner.
Algorithm – representing algorithm using
narrative
Exercise 1: create an
algorithm for making a cup of
coffee
15
Algorithm – representing algorithm using
narrative
2. Turn on kettle.
7. Stir.
Algorithm – representing algorithm using
pseudocode
Pseudocode
1. INPUT number1
2. INPUT number2
3. SET total number1 + number2
4. OUTPUT total 19
Algorithm – representing algorithm
20
Algorithm – representing algorithm:
comparing narrative and pseudocode
Narrative
Pseudocode
1. INPUT number1
2. INPUT number2
3. SET total number1 + number2
4. OUTPUT total
22
Algorithm – representing algorithm using
pseudocode
Exercise 2:
create an algorithm that will
accepts 3 numbers and then
calculate their average.
23
Algorithm – representing algorithm using
pseudocode
Solution:
25
Algorithm – representing algorithm using
flowcharts
26
Algorithm – representing algorithm:
flowchart
Flowchart
1. START
2. INPUT number1
3. INPUT number2
4. SET total number1 + number2
5. OUTPUT total 27
6. STOP
Algorithm – representing algorithm using
flowcharts
Flowchart
1. START
2. OUTPUT ‘enter 2
numbers’
3. INPUT number1,
number2
4. SET total number1
+ number2
5. OUTPUT total
6. STOP 28
Algorithm – representing algorithm using
flowcharts
Exercise 3:
1. START
2. INPUT number1, number2, number3
3. SET average (number1 + number2 +
number3) / 3
4. OUTPUT average
29
5. STOP
Algorithm – Quiz
1. Define algorithm
2. List at 3 characteristics of algorithms
3. What are two ways to represent algorithm?
30
Summary
Flowcharts
● Represented 31
algorithms using: