Chapter 4 Algorithms and Flow Charts
Chapter 4 Algorithms and Flow Charts
CHAPTER 06
ALGORITHMS AND FLOW CHARTS
XI
Computer Science (083)
Board : CBSE
Unit 1:
Computer Systems and Organisation (CSO)
Courtesy CBSE
Unit I
Computer Systems and Organisation (CSO)
10 Theory + 02 Practical)
Prepared by
Praveen M Jigajinni
DCSc & Engg, PGDCA,ADCA,MCA.MSc(IT),Mtech(IT),MPhil (Comp. Sci)
OBJECTIVES
INTRODUCTION
INTRODUCTION
INTRODUCTION
What is Algorithm?
Algorithm can be defined as: “A sequence
of activities to be processed for getting
desired output from a given input.”
ALGORITHM AND FLOW CHART
What is Algorithm?
Webopedia defines an algorithm as:
“A formula or set of steps for solving a
particularproblem. To be an algorithm,
a set of
rules must be unambiguous and have a clear
stopping point”.
MUHAMMAD IBN MUSA AL-KHWARIZMI
Muḥammad ibn Mūsā al-
Khwārizmī (Persian: ى,,,نموس,,,,,د ب,,,محم
وارزمی,;خ c. 780 – c. 850),
Formerly Latinized as Algoritmi, was
a Persian scholar who
produced works
in mathematics, astronomy, &
geography under the patronage of
the Caliph Al-Ma'mun of
the Abbasid Caliphate.
Around 820 AD he was appointed as the astronomer
and head of the library of the House of
Wisdom in Baghdad.
PROPERTIES OF ALGORITHM
Donald Ervin Knuth has given a list of five
properties for an algorithm, these
properties are:
1) FINITENESS
2) DEFINITENESS
3) INPUT
4) OUTPUT
5) EFFECTIVENESS
PROPERTIES OF ALGORITHM
1) FINITENESS:
An algorithm must always terminate
after a finite number of steps. It
means after every step one reach
closer to solution of the problem and
after a finite number of steps
algorithm reaches to an end point.
PROPERTIES OF ALGORITHM
2) DEFINITENESS
Each step of an algorithm must be
precisely defined. It is done by well
thought actions to be performed at
each step of the algorithm. Also the
actions are defined unambiguously for
each activity in the algorithm.
PROPERTIES OF ALGORITHM
3) INPUT
Any operation you perform need
some beginning value/quantities
associated with different activities in
the operation. So the value/quantities
are given to the algorithm before it
begins.
PROPERTIES OF ALGORITHM
4) OUTPUT:
One always expects output/result (expected
value/quantities) in terms of output from an
algorithm. The result may be obtained at
different stages of the algorithm. If some
result is from the intermediate stage of the
operation then it is known as intermediate
result and result obtained at the end of
algorithm is known as end result. The output
is expected value/quantities always have a
specified relation to the inputs.
PROPERTIES OF ALGORITHM
5) EFFECTIVENESS:
Algorithms to be developed/written
using basic operations. Actually operations
should be basic, so that even they can in
principle be done exactly and in a finite
amount of time by a person, by using paper
and pencil only.
PROPERTIES OF ALGORITHM
Step 1: Start
Step 2: Print “Good Morning‟
Step 3: Stop
ALGORITHM EXAMPLES
Step 1: Start
Step 2: Take length and breadth and
store them as L and B?
Step 3: Multiply by L and B and store it
in area
Step 4: Print area
Step 5: Stop
ALGORITHM EXAMPLES
Step 1: Start
Step 2: Take any number and store it in n.
Step 3: Check n value, if n > 0 then go to
step 5 else go to step 4
Step 4: Check n value, if n < 0 then go to
step 6 else go to step 7
ALGORITHM EXAMPLES
ANSI/ISO
Name Description
Shape
Shows the process's order of
operation. A line coming from
one symbol and pointing at
Flowline
another. Arrowheads are
(Arrowhead)
added if the flow is not the
standard top-to-bottom, left-
to right.
BUILDING BLOCKS OF FLOW CHART
ANSI/ISO
Name Description
Shape
Indicates the beginning and ending
of a program or sub-process.
Represented as a stadium, oval or
rounded (fillet) rectangle. They
Terminal usually contain the word "Start" or
"End", or another phrase signaling
the start or end of a process, such as
"submit inquiry" or "receive
product".
BUILDING BLOCKS OF FLOW CHART
ANSI/ISO
Name Description
Shape
Represents a set of operations that
Process changes value, form, or location of
data. Represented as a rectangle
BUILDING BLOCKS OF FLOW CHART
ANSI/ISO
Name Description
Shape
Shows a conditional operation that
determines which one of the two
paths the program will take. The
Decision operation is commonly a yes/no
question or true/false test.
Represented as a diamond
(rhombus).
BUILDING BLOCKS OF FLOW CHART
ANSI/ISO
Name Description
Shape
Indicates the process of inputting
Input /
and outputting data, as in entering
data or displaying results.
Output
Represented as a parallelogram
BUILDING BLOCKS OF FLOW CHART
ANSI/ISO
Name Description
Shape
Indicating additional
information about a step the
Annotation program. Represented as an
open rectangle with a dashed
(Comment) or solid line connecting it to
the corresponding symbol in
the flowchart.
BUILDING BLOCKS OF FLOW CHART
ANSI/ISO
Name Description
Shape
Shows named process
Predefined /Function which is defined
Process
elsewhere. Represented as
Functions a rectangle with double-
struck vertical edges.
BUILDING BLOCKS OF FLOW CHART
ANSI/ISO
Name Description
Shape
Pairs of labelled connectors
replace long or confusing
On-page
Connector
lines on a flowchart page.
Represented by a small
circle with a letter inside.
BUILDING BLOCKS OF FLOW CHART
ANSI/ISO
Name Description
Shape
A labelled connector for
use when the target is on
Off-page
Connector
another page. Represented
as a home plate-
shaped pentagon.
BUILDING BLOCKS OF FLOW CHART
ANSI/ISO
Name Description
Shape
Storage/ Magnetic Tape used for sec
Backup ondary storage/Backup
BUILDING BLOCKS OF FLOW CHART
ANSI/ISO
Name Description
Shape
Storage/ Magnetic Disk used for sec
Backup ondary storage/Backup
ADVANTAGES OF USING FLOWCHARTS
As we discussed flow chart is used for
representing algorithm in pictorial form.
This pictorial representation of a
solution/system is having many
advantages. These advantages are as
follows:
1.COMMUNICATION.
2.EFFECTIVE ANALYSIS.
3.DOCUMENTATION OF PROGRAM/SYSTEM.
4.EFFICIENT PROGRAM MAINTENANCE.
5.CODING OF THE PROGRAM.
ADVANTAGES OF USING FLOWCHARTS
1.COMMUNICATION:
1. Define Algorithm.
2. Define Flowchart.