KEMBAR78
GRADE 6 ALGORITHM.pptx
ABZ Private School
ICT Grade 6
Algorithm
Week 4
Lesson Objectives
• To learn what is algorithm
• To understand how to use it in
programming.
Aims
• We understand what an is used for in
Computer Science.
• We can create an algorithm to help solve a
real world problem.
OUTCOME
3
2
What Are Algorithms?
An algorithm is a list of step-by-step instructions that are followed in order
to get a task done.
Each instruction should be very simple so that a computer can understand
exactly what it needs to do.
1
Here is an example of a very simple algorithm that we
all perform every day in order to complete a task…
I am pupil robot…
• I follow all commands given to
me by your teacher
• You should give me simple
instructions to complete a task
• I hope you can give clear
instructions
Get me across the board….
I need some help getting to
my desk. Can you direct
me?
I only know the commands:
• Forward
• Backwards
• Turn left
• Turn right
How did you get on?
Why don’t you have a practise with a partner?
Can you guide a friend to the other side of the room?
Watch out for desks and other people though!
Remember you can only use the instructions:
• Forward
• Backward
• Turn left
• Turn right
THINK: How will you
know how far to walk
forwards or backwards?
What measurement are
you going to use? To
start with you could
use steps, but what
would be more
accurate?
Your turn!
Another word for a sequence
is a ‘program’.
• I need you to teach me a
program so that I can open
a jam jar.
• You can only use the
following instructions and
object names to complete
the task.
• It might be simple for you,
but I need your help!
Objects
Jar
Lid
Actions
Pick up
Put down
Hand on
Hand off
Turn left
Turn right
Stop
Go
Did it work?
Did your sequence work?
Try out your sequence with a partner. Do you need to debug it?
How could you improve it?
How do I debug something?
Debug is a fancy word for fixing
a sequence. All you have to do is
go back through and make sure
it all makes sense. Have you got
all your steps in the right order?
Have you missed out any steps?
Getting Changed
Undress
Choose
outfit
Put on
underwear
Put on socks
Put on top
Put on
bottoms
Outcome
You’re dressed!
Other Algorithms
In an algorithm, there is usually more than one way to solve a problem. For
example, the steps for getting dressed can be done in different orders to the
order you’ve just seen, but will still have the same outcome.
Undress
Choose
outfit
Put on
underwear
Put on socks
Put on top
Put on
bottoms
Outcome
You’re dressed!
Another example of a type of algorithm is
a cooking recipe.
Can you think of any more algorithms
from everyday life?
A ‘Bubble Sort’ Algorithm:
How it Works
A ‘Bubble Sort’ is a simple type of sorting that an algorithm on a computer
does. It is called this as the small elements of the sort with rise to the top.
Lets use numbers as an example.
Let us say that we are trying to sort the numbers:
5 1 4 2 8
A ‘Bubble Sort’ Algorithm: How it Works
This algorithm sorts things by comparing the first 2 numbers in a line at a time,
and swapping them if the number on the right is smaller than the number on the
left. It runs through each line until it no longer needs to swap any numbers.
As you can see, the numbers are still not sorted and the
algorithm has reached the end of the line of numbers.
It will run again until there are no more numbers to
swap, which indicates that its job is done.
Bubble Sort Algorithm:
Second Sort
The algorithm has completed its task and can now stop
running.
This is a very simple but slow algorithm.
Bubble Sort
Algorithm
11
10
1
2
9
8
3
5
7
6 4
Here is a simple animation that illustrates how a
‘bubble sort’ algorithm works.
GRADE 6 ALGORITHM.pptx

GRADE 6 ALGORITHM.pptx

  • 1.
    ABZ Private School ICTGrade 6 Algorithm Week 4
  • 2.
    Lesson Objectives • Tolearn what is algorithm • To understand how to use it in programming. Aims • We understand what an is used for in Computer Science. • We can create an algorithm to help solve a real world problem.
  • 3.
    OUTCOME 3 2 What Are Algorithms? Analgorithm is a list of step-by-step instructions that are followed in order to get a task done. Each instruction should be very simple so that a computer can understand exactly what it needs to do. 1 Here is an example of a very simple algorithm that we all perform every day in order to complete a task…
  • 4.
    I am pupilrobot… • I follow all commands given to me by your teacher • You should give me simple instructions to complete a task • I hope you can give clear instructions
  • 5.
    Get me acrossthe board…. I need some help getting to my desk. Can you direct me? I only know the commands: • Forward • Backwards • Turn left • Turn right
  • 6.
    How did youget on? Why don’t you have a practise with a partner? Can you guide a friend to the other side of the room? Watch out for desks and other people though! Remember you can only use the instructions: • Forward • Backward • Turn left • Turn right THINK: How will you know how far to walk forwards or backwards? What measurement are you going to use? To start with you could use steps, but what would be more accurate?
  • 7.
    Your turn! Another wordfor a sequence is a ‘program’. • I need you to teach me a program so that I can open a jam jar. • You can only use the following instructions and object names to complete the task. • It might be simple for you, but I need your help! Objects Jar Lid Actions Pick up Put down Hand on Hand off Turn left Turn right Stop Go
  • 8.
    Did it work? Didyour sequence work? Try out your sequence with a partner. Do you need to debug it? How could you improve it? How do I debug something? Debug is a fancy word for fixing a sequence. All you have to do is go back through and make sure it all makes sense. Have you got all your steps in the right order? Have you missed out any steps?
  • 9.
    Getting Changed Undress Choose outfit Put on underwear Puton socks Put on top Put on bottoms Outcome You’re dressed!
  • 10.
    Other Algorithms In analgorithm, there is usually more than one way to solve a problem. For example, the steps for getting dressed can be done in different orders to the order you’ve just seen, but will still have the same outcome. Undress Choose outfit Put on underwear Put on socks Put on top Put on bottoms Outcome You’re dressed! Another example of a type of algorithm is a cooking recipe. Can you think of any more algorithms from everyday life?
  • 11.
    A ‘Bubble Sort’Algorithm: How it Works A ‘Bubble Sort’ is a simple type of sorting that an algorithm on a computer does. It is called this as the small elements of the sort with rise to the top. Lets use numbers as an example. Let us say that we are trying to sort the numbers: 5 1 4 2 8
  • 12.
    A ‘Bubble Sort’Algorithm: How it Works This algorithm sorts things by comparing the first 2 numbers in a line at a time, and swapping them if the number on the right is smaller than the number on the left. It runs through each line until it no longer needs to swap any numbers. As you can see, the numbers are still not sorted and the algorithm has reached the end of the line of numbers. It will run again until there are no more numbers to swap, which indicates that its job is done.
  • 13.
    Bubble Sort Algorithm: SecondSort The algorithm has completed its task and can now stop running. This is a very simple but slow algorithm.
  • 14.
    Bubble Sort Algorithm 11 10 1 2 9 8 3 5 7 6 4 Hereis a simple animation that illustrates how a ‘bubble sort’ algorithm works.