0% found this document useful (0 votes)
116 views24 pages

Understanding Algorithms & Flowcharts

The document provides an overview of algorithms and flowcharts, explaining their definitions, characteristics, and steps for development. It includes examples of algorithms for various tasks and emphasizes the importance of clear instructions and logical flow in both algorithms and flowcharts. Additionally, it discusses the advantages of flowcharts and tools for creating them.

Uploaded by

swarajyalohani
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)
116 views24 pages

Understanding Algorithms & Flowcharts

The document provides an overview of algorithms and flowcharts, explaining their definitions, characteristics, and steps for development. It includes examples of algorithms for various tasks and emphasizes the importance of clear instructions and logical flow in both algorithms and flowcharts. Additionally, it discusses the advantages of flowcharts and tools for creating them.

Uploaded by

swarajyalohani
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

Subject: Computer

Studies
Topic: Algorithm and Flowchart

Std: V

CB/V/21-22 Algorithm and Flowchart 1 of 24


L A N
E R

to describe an algorithm and


flowchart

To create an algorithm for solving a


problem

To create a flowchart for solving a problem

To use decision making and repetition

CB/V/21-22 Algorithm and Flowchart 2 of 24


Algorithm
 An algorithm is a step-by-step instruction given to the
computer to solve a problem or perform a task.

Logical way
of solving a
Algorithm provides problem to the
Structured computer
way

Algorithms can be converted into programs that the


computer can understand and execute to give desired result.

CB/V/21-22 Algorithm and Flowchart 3 of 24


Steps to develop an
algorithm
STEP 1 • Describe the problem.

STEP 2 • Analyse the process to solve the problem.

STEP 3 • Develop the main steps for an algorithm.

STEP 4 • Add detailed steps for each main step.

Step 5 • Review and refine the algorithm if required.

CB/V/21-22 Algorithm and Flowchart of 24


Example 1: A cooking recipe - Sandwich

STEP Get the description and details of the Sandwich


1 recipe. Collect required ingredients.

Analyse the process such as grating the cheese,


STEP
2
slicing the tomatoes, buttering the slices, placing
the tomatoes and cheese slices on the bread.

CB/V/21-22 Algorithm and Flowchart of 24


STEP Develop the main steps and detailed steps of the
3&4 algorithm.
 Cut the tomato into fine slices.
 Grate cheese.
 Toast two slices of bread.
 Put cheese on the bread evenly.
 Place the tomato slices on the bread.
 Keep the other bread slice on the top, and the
sandwich is ready!

After tasting the sandwich, if you feel that it


STEP
needs more spice or more vegetables, refine the
5
sandwich by adding the required ingredients.

CB/V/21-22 Algorithm and Flowchart 6 of 24


Example 2: Coming back from school

STEP 1 Wait for the bus in the queue.

STEP 2 Get into the bus.

STEP 3 Get down at your bus stop.

STEP 4 Walk down to your house.

CB/V/21-22 Algorithm and Flowchart 7 of 24


Coming back home with your mother

STEP 1 Wait for your mother at the school entrance.

When you see your mother enter the school


STEP 2
gate, draw her attention.

Pick up your bag and walk out of the school


STEP 3
gate with your mother.

Get into a taxi and tell the driver where you


STEP 4
want to go.

STEP 5 Guide the taxi driver to your house.

CB/V/21-22 Algorithm and Flowchart 8 of 24


Example 3: Algorithm to find whether a
number is odd or even.

STEP 1 Enter a number N.

STEP 2 Read the number N.

STEP 3 Check if the number is divisible by 2.

If yes, then print ‘N is an even number’, else


STEP 4
print ‘N is an odd number’.

STEP 5 Exit.

CB/V/21-22 Algorithm and Flowchart 9 of 24


Characteristics of a good algorithm

Each instruction should be clear and have only one


meaning. One step should have only one instruction
or else it may lead to confusion and mistakes.

Each instruction should be performed in finite time.

No instruction should be repeated infinitely, that is,


the algorithm must end. The algorithm must have
an end statement after executing all statements.

After the instructions are executed, the user should


get the results.

CB/V/21-22 Algorithm and Flowchart 1 of 24


Flowchart
 The graphical or pictorial form of an algorithm is
called a flowchart.

detailed
Flowchart provides of algorithm
picture

 It uses special symbols to represent various statements of


an algorithm.

 The direction of flow in a flowchart is always from the top


to the bottom.

CB/V/21-22 Algorithm and Flowchart 1 of 24


Flowchart Symbols

CB/V/21-22 Algorithm and Flowchart 1 of 24


Flowchart Symbols

CB/V/21-22 Algorithm and Flowchart 1 of 24


Uses of a flowchart

to identify the method or process to


solve a problem

to plan the sequence of commands in


a computer program

to convey ideas and solutions

CB/V/21-22 Algorithm and Flowchart 1 of 24


Rules for making a flowchart

The requirements for drawing a flowchart should be listed


out in a logical order.

The flowchart should be easy to understand and follow.

Only one flow line should be used to connect to another


symbol.

The direction of flow should be from top to bottom or left


to right.

CB/V/21-22 Algorithm and Flowchart 1 of 24


Example 1: An algorithm and corresponding flowchart for adding two numbers.

CB/V/21-22 Algorithm and Flowchart 1 of 24


Example 2: An algorithm and flowchart for waking up in the morning based on a
decision box.

CB/V/21-22 Algorithm and Flowchart 1 of 24


Example 3: An algorithm to find the largest of three.

Step 1: Start.
Step 2: Get number A, B and C.
Step 3: If A>B go to step 4, otherwise go to step 5.
Step 4: If A>C go to step 6, otherwise go to step 8.
Step 5: If B>C go to step 7, otherwise go to step 8.
Step 6: Display the output “A is the largest number” and go
to step 9.
Step 7: Display the output “B is the largest number” and go
to step 9.
Step 8: Display the output “C is the largest number” and go
CB/V/21-22 Algorithm and Flowchart 1 of 24
Example 3: A Flowchart to find the largest of three.

CB/V/21-22 Algorithm and Flowchart 1 of 24


Working of the algorithm shown in Example 3

CB/V/21-22 Algorithm and Flowchart 2 of 24


Example 4: An algorithm and a flowchart to print the multiplication table for a
given number.

CB/V/21-22 Algorithm and Flowchart 2 of 24


Advantages of a Flowchart

A flowchart shows the logic of a program that serves


as a blueprint for the analysis and development
phase of a program.

Flowchart helps us to analyse the problem in a much


more effective way.

It is easy to understand and implement.

CB/V/21-22 Algorithm and Flowchart 2 of 24


Drawing a flowchart
using the computer

 There are many different applications that help us


draw a flowchart on a computer.
 Some of them are MS Word, OpenOffice Writer,
Edraw, SmartDraw and Visio.
 These applications offer various features that helps us
in drawing the flowchart.
CB/V/21-22 Algorithm and Flowchart 2 of 24
CB/V/21-22 Algorithm and Flowchart 2 of 24

You might also like