Lesson Notes By Weeks and Term - Senior Secondary 2

Algorithms and flowcharts I

Term: 2nd Term

Week: 7

Class: Senior Secondary School 2

Age: 16 years

Duration: 40 minutes of 2 periods each

Date:       

Subject:      Data Processing

Topic:-       Algorithms and Flowcharts I

SPECIFIC OBJECTIVES: At the end of the lesson, pupils should be able to

  1. Define an algorithm
  2. State the functions of an algorithm
  3. State and describe the characteristics of algorithms
  4. Write simple algorithms for problem solving

INSTRUCTIONAL TECHNIQUES: Identification, explanation, questions and answers, demonstration, videos from source

INSTRUCTIONAL MATERIALS: Videos, loud speaker, pictures, Data Processing for senior Secondary Education by Hiit Plc, WAPB Computer Studies for Senior Secondary I by Adekunle et al, On-line Materials.

INSTRUCTIONAL PROCEDURES

PERIOD 1-2

PRESENTATION

TEACHER’S ACTIVITY

STUDENT’S ACTIVITY

STEP 1

INTRODUCTION

The teacher reviews the previous lesson on program development

Students pay attention

STEP 2

EXPLANATION

He explains the meaning of algorithm and states the functions of algorithms

 

Students pay attention and participates

STEP 3

DEMONSTRATION

He further describes the characteristics of a good algorithm and explains the steps in writing one

Students pay attention and participate

STEP 4

NOTE TAKING

The teacher writes a summarized note on the board

The students copy the note in their books

 

NOTE

ALGORITHMS AND FLOWCHARTS

ALGORITHM

An algorithm is a list of instructions that shows the steps or procedures to follow in order to solve a specific problem That is, it is designed to perform an operation which will lead to the desired result, if followed correctly. E.g. the steps followed tor baking a good cake, is the algorithm of cake making.

 

THE FUNCTIONS OF AN ALGORITHM

  1. It gives step by step guide on how to solve a problem.
  2. It shows how a program works, i.e. the logic behind a program.
  3. It determines how fast a program can work.
  4. It makes sorting of programs very easy.
  5. It helps to find the shortest path to achieve the result of a program.

 

CHARACTERISTICS OF ALGORITHMS

  1. Clarity: Every instruction should be clear and easy to understand.
  2. Finite: It must begin at a point and end after a finite series of steps.
  3. Sequential: It must flow from one step to another, e.g. from top to bottom.
  4. Effective: It should get the desired results at the end.
  5. Scope: It should solve a specific problem or problems of similar nature.

 

GUIDELINES OR RULES FOR WRITING ALGORITHMS

To effectively write an algorithm that is practicable, the programmer or user needs to

Be conversant with the rules guiding the writing.

  1. Define the Term Algorithm: At the beginning of the program, give a brief definition of the term algorithm.
  2. Define the Problem: Give a name to the algorithm and define the problem it is meant to solve i.e. the aim.
  3. Designing an Algorithm: This can be done using the steps below
    1. Include a syntax or code format where necessary depending on the programming Language.
    2. Include the variables and how they are used.
  • If there are loops or specific instructions that require multiple executions, make room for sub-codes or sub-instructions.
  1. if instruction on loop fails, give a specific instruction on what the program should do.
  2. Use Jump statement to move from one program line to another
  3. Avoid the use of unwanted raw data.
  • Define expressions used.
  • Use stop to terminate the process.
  1. Check the Correctness of Algorithm: Implement the algorithm through program testing i.e. use test data.
  2. Documentation Preparation: Document all that has been done.

 

WRITING ALGORITHMS FOR PROBLEM SOLVING

  1. Computing Average of a Given Set of Numbers

To write an algorithm to calculate the average of two numbers and display

The result, the following steps are taken:

Step 1: Input the first number A

Step 2: Input the second number B

Step 3: Get C by adding A and B

Step 4: Get D by dividing C by 2 i.e. (C/2)

Step 5: Print out the result D

Step 6: Stop

 

Example 1: Using the algorithm above, calculate the average of 58 and 64.

Step 1: A = 58

Step 2: B = 64

Step 3: C = A+B = 58+ 64

Step 4: D = A+B/2 = 58 +64/2 = 122/2 = 61

Step 5: Print out D = 61

Step 6: Stop

 

Example 2: Evaluating the Equation Y = a(b -c)²/d+2.

Step 1: Get a, b, c, d

Step 2: Y=a*(b-c)²/d+2

Step 3: Y=a*(b-c)(b-c)/d+2

Step 4: Print out Y

Step 5: Stop

EVALUATION:   1. Explain the meaning of algorithm 

  1. State three functions of algorithm
  2. What are the characteristics of a good algorithm?
  3. List and explain the steps in writing an algorithm
  4. Write a simple algorithm for the problem below

Evaluate the equation below.

Y= a(b-c)²/d+2

CLASSWORK: As in evaluation

CONCLUSION: The teacher commends the students positively