[go: up one dir, main page]

0% found this document useful (0 votes)
986 views26 pages

Class 9 - Algorithm

learn more about the algorithm for class 9.
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)
986 views26 pages

Class 9 - Algorithm

learn more about the algorithm for class 9.
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/ 26

PYTHON Key stage IV Class IX

Keys Concepts # 1

ALGORITHM

January 2024 © ICT Curriculum, MoESD


PYTHON Key stage IV Class IX

Concept Overview

Coding Sub - Concepts


Concept

● Definition of algorithm
● Characteristics of an algorithm
Algorithm
● Examples of algorithm
● Design algorithm for simplifying problems

January 2024 © ICT Curriculum, MoESD


PYTHON Key stage IV Class IX

Objectives

● Define algorithm with examples.


● Explain the characteristics of an algorithm.
● Write an algorithm for a given problem.
● Explain the benefits of using algorithms to solve a problem.

January 2024 © ICT Curriculum, MoESD


PYTHON Key stage IV Class IX

ACTIVITIES
1. Understanding Algorithm
2. Demo 1 - Brushing your teeth
3. Activity 1 - Writing Algorithm
4. Demo 2 - Adding two numbers
5. Activity 2 - Multiplying two numbers
ALGORITHM 6. Activity 3 - Area of circle
7. Activity 4 - Perimeter of rectangle
8. Activity 5 - Eligibility for voting
9. Activity 6 - Even or odd Number
10. Activity 7 - Check Your Understanding
11. Activity 8 - Importance of learning
algorithm
12. Activity 9 - Practice Questions
January 2024 © ICT Curriculum, MoESD
PYTHON Key stage IV Class IX

Algorithm
An algorithm is a step-by-step set of instructions for performing a task.

Step Algorithm
1 START Inputs
2 Read first number

3 Read second number


Process
4 Add first and second
number
Output
5 Display the sum

6 STOP/End January 2024 © ICT Curriculum, MoESD


PYTHON Key stage IV Class IX

Algorithm (cont.)
For an algorithm, you need to have the following:

1. Input 2. Process 3. Output

January 2024 © ICT Curriculum, MoESD


PYTHON Key stage IV Class IX

Demo 1 - Brushing Your Teeth


Step Algorithm
1 START
2 Walk to a bathroom.
3 Put toothpaste on the toothbrush.
4 Brush your teeth.
5 Rinse your mouth and toothbrush.
6 Put the toothbrush away.
7 STOP/End
January 2024 © ICT Curriculum, MoESD
PYTHON Key stage IV Class IX

Activity 1 - Writing Algorithm


1. Divide yourselves into four groups.
2. Each group will receive a topic and in respective groups
discuss the steps.
3. Write an algorithm for the problem in your notebook.
4. Then share the algorithm to the class.

1 2 C
3 4
Cooking ema-
Crossing a road Preparing suja datshi Washing hands

January 2024 © ICT Curriculum, MoESD


PYTHON Key stage IV Class IX

Activity 1 - Solution
1 2

Algorithm for Crossing a Algorithm for Preparing


road suja
1. Walk to an edge of a road. 1. Add suja tea leaves and
water in a pot.
2. Look right and left for a
vehicle. 2. Boil for 15 minutes.
3. Wait if there is a vehicle. 3. Takeout the tea leaves.
4. Cross the road once it is 4. Add salt and butter.
safe.
5. Mix with a machine.
5. Reach the other side.
January 2024
6. Ready to drink. © ICT Curriculum, MoESD
PYTHON Key stage IV Class IX

Activity 1 - Solution (cont.)


3 4

Algorithm for Algorithm for Washing


Preparing ema- hands
datshi 1. Wet hands and apply soap.
1. Wash the chillies, 2. Rub the palms together.
onions and tomatoes. 3. Rub the back of hands.
2. Chop and put in a pot. 4. Rub the back of the fingers.
3. Add oil, salt and 5. Rub and clean the thumbs.
cheese. 6. Rub and clean the tips of
4. Cook for 20 minutes. the fingers.
5. Stir for few seconds. 7. Rinse the hands.
January 2024 © ICT Curriculum, MoESD
PYTHON Key stage IV Class IX

Importance of Algorithm
1 5
3

To provide
To find a solution To understand a straightforward
for the problem. the core idea explanation of how
2 4
behind a problem. it works without
getting into too
To break down a technical.
To understand the complex problem
flow of the problem. into smaller and
more manageable
steps.

January 2024 © ICT Curriculum, MoESD


PYTHON Key stage IV Class IX

Characteristics of Algorithm
Watch the video to understand the characteristics of algorithm

January 2024 © ICT Curriculum, MoESD


PYTHON Key stage IV Class IX

Characteristics of Algorithm
Unambiguous
Independent
Algorithm steps
Algorithm must should be clear and
be applicable to straightforward.
any language.
Characteristi
Feasibility Input
cs
Algorithm of Algorithm should
should be Algorithm have 0 or more
feasible. inputs.

Finiteness Output

Algorithm should Algorithm should have


terminate after certain have at least one
number of steps. output.
January 2024 © ICT Curriculum, MoESD
PYTHON Key stage IV Class IX

Demo 2 - Finding Average of Two Numbers

Solution
Ste Algorithm
p
Write an algorithm to
1 START.
find the average of any
two numbers entered by 2 Read any two numbers(x and y).
the user and display the
result. 3 Average = (x+y)/2.

4 Display Average.

5 STOP/End.
January 2024 © ICT Curriculum, MoESD
PYTHON Key stage IV Class IX

Activity 2 - Multiplying Two Numbers

Solution
Ste Algorithm
p
Write an algorithm to
multiply any two 1 START.
numbers and display
2 Take input for x and y.
the result.
3 Multiply = x * y.
4 Display Multiply.
5 STOP.

January 2024 © ICT Curriculum, MoESD


PYTHON Key stage IV Class IX

Activity 3 - Area of Circle


Solution
Ste Algorithm
Write an algorithm in p
your notebook to find 1 START.
the area of a circle when
a user enters a radius 2 Read a radius of a circle
(r).
from the keyboard and
display the area. 3 area = 3.14*r*r.
4 Display area.
5 STOP.
January 2024 © ICT Curriculum, MoESD
PYTHON Key stage IV Class IX

Activity 4 - Perimeter of Rectangle

Solution
Step Algorithm
Write an algorithm
1 START.
in your notebook to
find the perimeter 2 Read a length and width (l,
of a rectangle and w).
display the perimeter = 2*(l+w) or
3
perimeter. perimeter = l+w+l+w.
4 Display perimeter.
5 STOP.
January 2024 © ICT Curriculum, MoESD
PYTHON Key stage IV Class IX

Activity 5 - Eligibility for voting


Solution
Write an algorithm in your
Ste Algorithm
notebook to check whether p
a person is eligible to cast a
vote using the following 1 START.
criteria: 2 Read the age.
1. If the age is 18 and Check if age>= 18, then got to step
3
above, then display a 4
message ‘Eligible to 4 Display ‘Eligible to vote’.
vote’
5 Otherwise, display ‘Not eligible to
2. Otherwise display a vote’.
message, ‘Not eligible to
January 2024 © ICT Curriculum, MoESD
PYTHON Key stage IV Class IX

Activity 6 - Even or Odd number


Solution

Ste Algorithm
Arrange the given algorithm in p
correct order to check whether the
1 START.
number is even or odd.
2 Read the number(num).
1. R=num%2
2. Display ‘Number is Even’ 3 R=num%2.
3. START
4 If R is equal to zero.
4. Display ‘Number is Odd’
5. STOP 5 Display ‘Number is Even’.
6. If R is equal to zero
6 Otherwise
7. Read the number(num)
7 Display ‘Number is Odd’.

8 STOP.
January 2024 © ICT Curriculum, MoESD
PYTHON Key stage IV Class IX

Activity 7 - Check your understanding


Mention and explain the characteristics of an algorithm.

1 2 3

Unambiguous Input Finiteness


Algorithm steps should Algorithm may or may Algorithm should
be clear and not take input. terminate after certain
straightforward. number of steps.

4 5 6

Independent Feasibility Output


Algorithm must be Algorithm should be Algorithm should have
applicable to any feasible. have at least one
language. output.
January 2024 © ICT Curriculum, MoESD
PYTHON Key stage IV Class IX

Activity 8 - Importance of learning algorithm

List any three importance of learning algorithm.

To understand the core idea behind a


problem.

To understand the flow of the problem.

To break down a complex problem.

January 2024 © ICT Curriculum, MoESD


PYTHON Key stage IV Class IX

Practice 1 - Greatest Number


Solutio
n

Ste Algorithm
p
1 START
Write an algorithm to
find the greatest of two 2 Read any two numbers a, b

numbers. 3 Check if a>b, then go to step 4

4 Display “a is greater than b”

5 Otherwise, Display “b is greater than


a”

6 STOP
January 2024 © ICT Curriculum, MoESD
PYTHON Key stage IV Class IX

Practice 2 - Pass or FailSolutio


n

Step Algorithm

Write an algorithm that 1 START


prompts the user to input 2 Enter a mark [m]
their exam marks and 3 Check if m>=40, then go to
step 4
determines whether they
4 Display ”Passed”
have passed or failed. The
pass mark is 40 out of 100. 5 Otherwise, Display “Failed”

6 STOP

January 2024 © ICT Curriculum, MoESD


PYTHON Key stage IV Class IX

Key
Points
● An algorithm is step-by-step solution for a specific problem.
● In algorithm you need to have input, process and output.
● Algorithm is used to understand the flow of the problem.
● Algorithm helps to break down a complex problem into smaller and
more manageable steps.

January 2024 © ICT Curriculum, MoESD


PYTHON Key stage IV Class IX

Key Points (Cont.)

● Characteristics of algorithms are:

○ Unambiguous : steps should be clear.


○ Inputs : it may or may not take input.
○ Output : should produce at least one output.
○ Finite : should have limited number of steps.
○ Feasibility : should be feasible.
○ Independent : must be applicable to any languages.

January 2024 © ICT Curriculum, MoESD


PYTHON Key stage IV Class IX

བཀྲིན་ཆེ།
THANK YOU

January 2024 © ICT Curriculum, MoESD

You might also like