Algorithms and Flow Charts in Computer Science: A Comprehensive Overview

 
Unit 1:
Unit 1:
 
Computer Systems and Organisation
Computer Systems and Organisation
(CSO)
(CSO)
 
Unit 1:
Unit 1:
 
Courtesy  CBSE
Courtesy  CBSE
 
Computer Systems and Organisation (CSO)
Computer Systems and Organisation (CSO)
 
Unit I
Unit I
 
 10 Theory + 02 Practical)
 
Praveen M Jigajinni
Praveen M Jigajinni
 
Courtesy  CBSE
Courtesy  CBSE
 
Computer Systems and Organisation (CSO)
Computer Systems and Organisation (CSO)
 
 
able to define problem;
able to define problem;
able to define algorithm;
able to define algorithm;
write algorithms for simple problems;
write algorithms for simple problems;
explain properties of an algorithm;
explain properties of an algorithm;
the meaning of flowchart;
the meaning of flowchart;
explain the need of flow chart;
explain the need of flow chart;
explain different symbols used in flow chart;
explain different symbols used in flow chart;
draw flow chart for simple problems; and
draw flow chart for simple problems; and
convert a flow chart into an algorithm and
convert a flow chart into an algorithm and
vice versa.
vice versa.
 
OBJECTIVES
OBJECTIVES
 
 
 
 
 
 
Intelligence is one of the key
Intelligence is one of the key
characteristics which differentiate a human
characteristics which differentiate a human
being from other  living creatures on the
being from other  living creatures on the
earth. Basic intelligence covers day to day
earth. Basic intelligence covers day to day
problem solving and  making strategies to
problem solving and  making strategies to
handle different situations which keep
handle different situations which keep
arising in day to day life.
arising in day to day life.
 
INTRODUCTION
INTRODUCTION
 
 
 
One  person goes Bank to withdraw money.
One  person goes Bank to withdraw money.
After knowing the balance in his account,
After knowing the balance in his account,
he/she  decides to withdraw the entire
he/she  decides to withdraw the entire
amount from his account but he/she has to
amount from his account but he/she has to
leave minimum  balance in his account.
leave minimum  balance in his account.
 
 
 
Here deciding about how much amount
Here deciding about how much amount
he/she may withdraw from  the account is
he/she may withdraw from  the account is
one of the example of the basic
one of the example of the basic
intelligence. During the process of solving
intelligence. During the process of solving
any problem, one tries to find the
any problem, one tries to find the
necessary steps to be taken in a sequence.
necessary steps to be taken in a sequence.
 
 
 
Algorithm can be defined as: “A sequ
Algorithm can be defined as: “A sequ
ence of activities to be processed for getti
ence of activities to be processed for getti
ng desired output from a given input.”
ng desired output from a given input.”
 
Webopedia defines an algorithm as:
Webopedia defines an algorithm as:
 
 
 
    “A formula or set of steps for solving a
    “A formula or set of steps for solving a
 particularproblem.   To be an algorithm,  a set
 particularproblem.   To be an algorithm,  a set
 of  rules must be unambiguous and have a  cl
 of  rules must be unambiguous and have a  cl
ear stopping point”.
ear stopping point”.
 
 
 
 Muḥammad ibn Mūsā al-
 Muḥammad ibn Mūsā al-
Khwārizmī (Persian: 
Khwārizmī (Persian: 
محمد بن موسى
محمد بن موسى
خوارزمی
خوارزمی
‎; c. 780 – c. 850),
‎; c. 780 – c. 850),
Formerly Latinized as Algoritmi, was
Formerly Latinized as Algoritmi, was
a Persian scholar who produced
a Persian scholar who produced
works in mathematics, astronomy,
works in mathematics, astronomy,
&  geography    under the patronage
&  geography    under the patronage
of the Caliph Al-Ma'mun of
of the Caliph Al-Ma'mun of
the Abbasid Caliphate.
the Abbasid Caliphate.
 
Around 820 AD he was appointed as the astronomer
Around 820 AD he was appointed as the astronomer
and head of the library of the House of
and head of the library of the House of
Wisdom in Baghdad.
Wisdom in Baghdad.
 
Donald Ervin Knuth has given a list of five
Donald Ervin Knuth has given a list of five
properties for an algorithm, these
properties for an algorithm, these
properties are:
properties are:
1)
FINITENESS
2)
DEFINITENESS
3)
INPUT
4)
OUTPUT
5)
EFFECTIVENESS
 
1)
FINITENESS:
 
An algorithm must always terminate
An algorithm must always terminate
after a finite number of steps. It
after a finite number of steps. It
means after every step one reach
means after every step one reach
closer to solution of the problem and
closer to solution of the problem and
after a finite number of steps
after a finite number of steps
algorithm reaches to an end point.
algorithm reaches to an end point.
 
2) 
DEFINITENESS
 
Each step of an algorithm must be
Each step of an algorithm must be
precisely defined. It is done by well
precisely defined. It is done by well
thought actions to be performed at
thought actions to be performed at
each step of the algorithm. Also the
each step of the algorithm. Also the
actions are defined unambiguously for
actions are defined unambiguously for
each activity in the algorithm.
each activity in the algorithm.
 
3) 
INPUT
 
Any operation you perform need
Any operation you perform need
some beginning value/quantities
some beginning value/quantities
associated with different activities in
associated with different activities in
the operation. So the value/quantities
the operation. So the value/quantities
are  given to the algorithm before it
are  given to the algorithm before it
begins.
begins.
 
4) 
OUTPUT
:
 
One always expects output/result
One always expects output/result
(expected value/quantities) in terms of output
(expected value/quantities) in terms of output
from an algorithm. The result may be obtained
from an algorithm. The result may be obtained
at different stages of the  algorithm. If some
at different stages of the  algorithm. If some
result is from the intermediate stage of the
result is from the intermediate stage of the
operation then it is  known as intermediate
operation then it is  known as intermediate
result and result obtained at the end of
result and result obtained at the end of
algorithm is known  as end result. The output
algorithm is known  as end result. The output
is expected value/quantities always have a
is expected value/quantities always have a
specified  relation to the inputs.
specified  relation to the inputs.
 
5) 
EFFECTIVENESS
:
 
Algorithms to be developed/written
Algorithms to be developed/written
using basic operations. Actually operations
using basic operations. Actually operations
should be basic, so that even they can in
should be basic, so that even they can in
principle be done exactly and in a finite
principle be done exactly and in a finite
amount of time by a person, by using paper
amount of time by a person, by using paper
and pencil only.
and pencil only.
 
Any algorithm should have all these five
Any algorithm should have all these five
properties otherwise it will not fulfil the
properties otherwise it will not fulfil the
basic objective of solving a problem in finite
basic objective of solving a problem in finite
time. As you have seen in previous
time. As you have seen in previous
examples, every step of an algorithm puts
examples, every step of an algorithm puts
you closer to the solution
you closer to the solution
 
Let  us  take  one  simple  day-to-day  example
Let  us  take  one  simple  day-to-day  example
by  writing  algorithm  for  making, “Maggi
by  writing  algorithm  for  making, “Maggi
Noodles‟ as a food.
Noodles‟ as a food.
 
Step 1:
Step 1:
  
  
Start
Start
Step 2:
Step 2:
  
  
Take pan with water
Take pan with water
Step 3:
Step 3:
  
  
Put pan on the burner
Put pan on the burner
Step 4:
Step 4:
  
  
Switch on the gas/burner
Switch on the gas/burner
Step 5: 
Step 5: 
 
 
Put magi and masala
Put magi and masala
Step 6:
Step 6:
  
  
Give two minutes to boil
Give two minutes to boil
Step 7:
Step 7:
  
  
Take off the pan
Take off the pan
Step 8:
Step 8:
  
  
Take out the magi with the help of
Take out the magi with the help of
  
  
fork/spoon
fork/spoon
Step 9:
Step 9:
  
  
Put the maggi on the plate and serve it
Put the maggi on the plate and serve it
Step 10:
Step 10:
 
 
Stop.
Stop.
 
Write an algorithm to print “Good Morning‟
Write an algorithm to print “Good Morning‟
 
Step 1:
Step 1:
  
  
Start
Start
Step 2: 
Step 2: 
  
  
Print “Good Morning‟
Print “Good Morning‟
Step 3:
Step 3:
  
  
Stop
Stop
 
Write an algorithm to find area of a rectangle.
Write an algorithm to find area of a rectangle.
 
Step 1:
Step 1:
 
 
Start
Start
Step 2:
Step 2:
 
 
Take length and breadth and
Take length and breadth and
  
  
store them as L and B?
store them as L and B?
Step 3:
Step 3:
 
 
Multiply by L and B and store it
Multiply by L and B and store it
  
  
in area
in area
Step 4:
Step 4:
 
 
Print area
Print area
Step 5:
Step 5:
 
 
Stop
Stop
 
Write an algorithm to check whether he is
Write an algorithm to check whether he is
eligible to vote? (more than or equal to 18
eligible to vote? (more than or equal to 18
years old).
years old).
 
Step 1:
Step 1:
 
 
Start
Start
Step 2:
Step 2:
 
 
Take age and store it in age
Take age and store it in age
Step 3:
Step 3:
 
 
Check age value, if age >= 18 then go
Check age value, if age >= 18 then go
  
  
to step 4 else step 5
to step 4 else step 5
Step 4:
Step 4:
 
 
Print “Eligible to vote” and go to
Print “Eligible to vote” and go to
  
  
step 6
step 6
Step 5: 
Step 5: 
 
 
Print “Not eligible to vote”
Print “Not eligible to vote”
Step 6:
Step 6:
 
 
Stop
Stop
 
Write an algorithm to check whether given
Write an algorithm to check whether given
number is +ve, -ve or zero.
number is +ve, -ve or zero.
Step 1:
Step 1:
 
 
Start
Start
Step 2:
Step 2:
 
 
Take any number and store it in n.
Take any number and store it in n.
Step 3:
Step 3:
 
 
Check n value, if n > 0 then go to
Check n value, if n > 0 then go to
  
  
step 5 else go to step 4
step 5 else go to step 4
 Step 4:
 Step 4:
 
 
Check n value, if n < 0 then go to
Check n value, if n < 0 then go to
  
  
step 6 else go to step 7
step 6 else go to step 7
 
Write an algorithm to check whether given
Write an algorithm to check whether given
number is +ve, -ve or zero.
number is +ve, -ve or zero.
 
Step 5: 
Step 5: 
 
 
Print “Given number is +ve”and go
Print “Given number is +ve”and go
  
  
to step 8
to step 8
Step 6: 
Step 6: 
 
 
Print “Given number is -ve” and go
Print “Given number is -ve” and go
  
  
to step 8
to step 8
Step 7: 
Step 7: 
 
 
Print “Given number is zero”
Print “Given number is zero”
Step 8:
Step 8:
 
 
Stop
Stop
 
The flowchart is a diagram which visually pre
The flowchart is a diagram which visually pre
sents the flow of data through processing
sents the flow of data through processing
systems. This means by seeing a flow chart o
systems. This means by seeing a flow chart o
ne can know the operations performed and
ne can know the operations performed and
the sequence of these  operations in a syste
the sequence of these  operations in a syste
m. Algorithms are nothing but sequence of
m. Algorithms are nothing but sequence of
steps for solving problems. So a flow chart ca
steps for solving problems. So a flow chart ca
n be used for representing an  algorithm. A
n be used for representing an  algorithm. A
flowchart, will describe the operations
flowchart, will describe the operations
(and in what sequence) are required
(and in what sequence) are required
to  solve a given problem.
to  solve a given problem.
 
A flowchart is a type of diagram that
A flowchart is a type of diagram that
represents an algorithm, workflow or
represents an algorithm, workflow or
process. The flowchart shows the steps as
process. The flowchart shows the steps as
boxes of various kinds, and their order by
boxes of various kinds, and their order by
connecting the boxes with arrows. This
connecting the boxes with arrows. This
diagrammatic representation illustrates a
diagrammatic representation illustrates a
solution model to a given problem.
solution model to a given problem.
Flowcharts are used in analyzing, designing,
Flowcharts are used in analyzing, designing,
documenting or managing a process or
documenting or managing a process or
program in various fields.
program in various fields.
 
The American National Standards
The American National Standards
Institute (ANSI) set standards for flowcharts
Institute (ANSI) set standards for flowcharts
and their symbols in the
and their symbols in the
1960s. The International Organization for
1960s. The International Organization for
Standardization(ISO) adopted the ANSI
Standardization(ISO) adopted the ANSI
symbols in 1970. The current standard was
symbols in 1970. The current standard was
revised in 1985. Generally, flowcharts flow
revised in 1985. Generally, flowcharts flow
from top to bottom and left to right.
from top to bottom and left to right.
 
BUILDING BLOCKS  OF FLOW CHART
BUILDING BLOCKS  OF FLOW CHART
 
BUILDING BLOCKS  OF FLOW CHART
BUILDING BLOCKS  OF FLOW CHART
 
BUILDING BLOCKS  OF FLOW CHART
BUILDING BLOCKS  OF FLOW CHART
 
BUILDING BLOCKS  OF FLOW CHART
BUILDING BLOCKS  OF FLOW CHART
 
BUILDING BLOCKS  OF FLOW CHART
BUILDING BLOCKS  OF FLOW CHART
 
BUILDING BLOCKS  OF FLOW CHART
BUILDING BLOCKS  OF FLOW CHART
 
BUILDING BLOCKS  OF FLOW CHART
BUILDING BLOCKS  OF FLOW CHART
 
BUILDING BLOCKS  OF FLOW CHART
BUILDING BLOCKS  OF FLOW CHART
 
BUILDING BLOCKS  OF FLOW CHART
BUILDING BLOCKS  OF FLOW CHART
 
ADVANTAGES OF USING FLOWCHARTS
ADVANTAGES OF USING FLOWCHARTS
 
A
A
s
s
 
 
w
w
e
e
 
 
d
d
i
i
s
s
c
c
u
u
s
s
s
s
e
e
d
d
 
 
f
f
l
l
o
o
w
w
 
 
c
c
h
h
a
a
r
r
t
t
 
 
i
i
s
s
 
 
u
u
s
s
e
e
d
d
 
 
f
f
o
o
r
r
r
r
e
e
p
p
r
r
e
e
s
s
e
e
n
n
t
t
i
i
n
n
g
g
 
 
a
a
l
l
g
g
o
o
r
r
i
i
t
t
h
h
m
m
 
 
i
i
n
n
 
 
p
p
i
i
c
c
t
t
o
o
r
r
i
i
a
a
l
l
 
 
f
f
o
o
r
r
m
m
.
.
T
T
h
h
i
i
s
s
 
 
 
 
p
p
i
i
c
c
t
t
o
o
r
r
i
i
a
a
l
l
 
 
r
r
e
e
p
p
r
r
e
e
s
s
e
e
n
n
t
t
a
a
t
t
i
i
o
o
n
n
 
 
o
o
f
f
 
 
a
a
s
s
o
o
l
l
u
u
t
t
i
i
o
o
n
n
/
/
s
s
y
y
s
s
t
t
e
e
m
m
 
 
i
i
s
s
 
 
h
h
a
a
v
v
i
i
n
n
g
g
 
 
m
m
a
a
n
n
y
y
a
a
d
d
v
v
a
a
n
n
t
t
a
a
g
g
e
e
s
s
.
.
 
 
T
T
h
h
e
e
s
s
e
e
 
 
a
a
d
d
v
v
a
a
n
n
t
t
a
a
g
g
e
e
s
s
 
 
a
a
r
r
e
e
 
 
a
a
s
s
f
f
o
o
l
l
l
l
o
o
w
w
s
s
:
:
 
1.
COMMUNICATION.
COMMUNICATION.
2.
EFFECTIVE ANALYSIS.
EFFECTIVE ANALYSIS.
3.
DOCUMENTATION OF PROGRAM/SYSTEM.
DOCUMENTATION OF PROGRAM/SYSTEM.
4.
EFFICIENT PROGRAM MAINTENANCE.
EFFICIENT PROGRAM MAINTENANCE.
5.
CODING OF THE PROGRAM.
CODING OF THE PROGRAM.
 
ADVANTAGES OF USING FLOWCHARTS
ADVANTAGES OF USING FLOWCHARTS
 
1.
COMMUNICATION:
COMMUNICATION:
 
 
A Flowchart can be used as a better way of
A Flowchart can be used as a better way of
communication of the logic of a system and
communication of the logic of a system and
steps involve in the solution, to all concerned
steps involve in the solution, to all concerned
particularly to the client of system.
particularly to the client of system.
 
 
ADVANTAGES OF USING FLOWCHARTS
ADVANTAGES OF USING FLOWCHARTS
 
2.
EFFECTIVE ANALYSIS:
EFFECTIVE ANALYSIS:
 
A flowchart of a problem can be used for
A flowchart of a problem can be used for
effective analysis of the problem.
effective analysis of the problem.
 
ADVANTAGES OF USING FLOWCHARTS
ADVANTAGES OF USING FLOWCHARTS
 
3.
3.
DOCUMENTATION OF PROGRAM/
DOCUMENTATION OF PROGRAM/
SYSTEM:
SYSTEM:
 
Program flowcharts are a vital part of a  good
Program flowcharts are a vital part of a  good
program documentation. Program document is
program documentation. Program document is
used for various purposes like  knowing the
used for various purposes like  knowing the
components in the program, complexity of the
components in the program, complexity of the
program etc.
program etc.
 
ADVANTAGES OF USING FLOWCHARTS
ADVANTAGES OF USING FLOWCHARTS
 
4. 
4. 
EFFICIENT PROGRAM
EFFICIENT PROGRAM
MAINTENANCE:
MAINTENANCE:
 
Once a program is developed and becomes
Once a program is developed and becomes
operational it needs time to time maintenance.
operational it needs time to time maintenance.
With help of flowchart maintenance become
With help of flowchart maintenance become
easier.
easier.
 
ADVANTAGES OF USING FLOWCHARTS
ADVANTAGES OF USING FLOWCHARTS
 
5. 
5. 
CODING OF THE PROGRAM:
CODING OF THE PROGRAM:
 
Any design of solution of a problem is finally
Any design of solution of a problem is finally
converted into computer program. Writing code
converted into computer program. Writing code
referring the flowchart of the solution become
referring the flowchart of the solution become
easy.
easy.
 
LIMITATIONS  OF USING FLOWCHARTS
LIMITATIONS  OF USING FLOWCHARTS
 
1)
COMPLEXITY OF LOGIC:
COMPLEXITY OF LOGIC:
 
 
If program logic is
If program logic is
complex then flowchart of the program
complex then flowchart of the program
becomes complicated.
becomes complicated.
 
2) 
2) 
ALTERATIONS AND MODIFICATIONS IN LOGIC
ALTERATIONS AND MODIFICATIONS IN LOGIC
:
:
any alterations in the program logic may require
any alterations in the program logic may require
re­drawing of flowchart completely.
re­drawing of flowchart completely.
 
3) 
3) 
REUSE IS NOT POSSIBLE
REUSE IS NOT POSSIBLE
: 
: 
As the flowchart
As the flowchart
symbols cannot be typed, always reproduction
symbols cannot be typed, always reproduction
of flowchart symbols are required.
of flowchart symbols are required.
 
FLOWCHART EXAMPLES
FLOWCHART EXAMPLES
 
 
 
Draw a flowchart to find the simple interest.
Draw a flowchart to find the simple interest.
(Sequence)
(Sequence)
 
FLOWCHART EXAMPLES
FLOWCHART EXAMPLES
 
 
 
Draw a flowchart to find bigger number
Draw a flowchart to find bigger number
among two numbers (selective)
among two numbers (selective)
 
FLOWCHART EXAMPLES
FLOWCHART EXAMPLES
 
 
 
Draw a flow chart to find factorial of any
Draw a flow chart to find factorial of any
number.
number.
 
FLOWCHART EXAMPLES
FLOWCHART EXAMPLES
 
FLOWCHART EXAMPLES
FLOWCHART EXAMPLES
 
 
 
Draw a flow chart to print the number from 1
Draw a flow chart to print the number from 1
to  N.
to  N.
 
FLOWCHART EXAMPLES
FLOWCHART EXAMPLES
 
FLOWCHART EXAMPLES
FLOWCHART EXAMPLES
 
Draw a flow chart to find biggest number
Draw a flow chart to find biggest number
among   N numbers.
among   N numbers.
 
FLOWCHART EXAMPLES
FLOWCHART EXAMPLES
 
CLASS TEST
CLASS TEST
 
 1.  A step by step method for solving a problem
 1.  A step by step method for solving a problem
using English Language
using English Language
 
 (a)  program  (b)  Flowchart
 (a)  program  (b)  Flowchart
 (c)  statement  (d)  Algorithm
 (c)  statement  (d)  Algorithm
 
2.
Set of statements is executed based upon
Set of statements is executed based upon
conditional test.
conditional test.
 
 (a)  Looping  (b)  Selective
 (a)  Looping  (b)  Selective
(c)  Sequence  (d)  None
(c)  Sequence  (d)  None
 
MULTIPLE CHOICE QUESTIONS
MULTIPLE CHOICE QUESTIONS
Time: 40 Min                                Max Marks 20
Time: 40 Min                                Max Marks 20
 
3.
Set of statements is executed again and again
Set of statements is executed again and again
based upon conditional test.
based upon conditional test.
 (a)  Looping  (b)  Selective
 (a)  Looping  (b)  Selective
(c)
Sequence  (d)  None
Sequence  (d)  None
 
4.  The graphical representation of algorithm is
4.  The graphical representation of algorithm is
 (a)  program  (b)  Flowchart
 (a)  program  (b)  Flowchart
 (c)  statement  (d)  Algorithm
 (c)  statement  (d)  Algorithm
 
5.  All instructions are executed one after other.
5.  All instructions are executed one after other.
 (a)  Looping  (b)  Selective
 (a)  Looping  (b)  Selective
(c)  Sequence  (d)  None
(c)  Sequence  (d)  None
 
MULTIPLE CHOICE QUESTIONS
MULTIPLE CHOICE QUESTIONS
 
1.
Define Algorithm.
Define Algorithm.
 
2.
Define Flowchart.
Define Flowchart.
 
3.
Write an algorithm to find the sum of two
Write an algorithm to find the sum of two
numbers.
numbers.
 
4.
Write an algorithm to find the area of a
Write an algorithm to find the area of a
triangle.
triangle.
 
5.  Write an algorithm to find whether given
5.  Write an algorithm to find whether given
number is odd or even.
number is odd or even.
 
ANSWER THE FOLLOWING QUESTIONS.
ANSWER THE FOLLOWING QUESTIONS.
 
6.
Write an algorithm to find the sum of all even
Write an algorithm to find the sum of all even
number up to given number.
number up to given number.
 
7.
Draw a flowchart to find the area of a circle.
Draw a flowchart to find the area of a circle.
 
9.
Draw a flowchart to find the smallest number
Draw a flowchart to find the smallest number
among n numbers.
among n numbers.
 
ANSWER THE FOLLOWING QUESTIONS.
ANSWER THE FOLLOWING QUESTIONS.
 
10.
Draw a flowchart to find the sum of all
Draw a flowchart to find the sum of all
multiples of 5 up to given number.
multiples of 5 up to given number.
 
11.  Mona is confused about finite loop and
11.  Mona is confused about finite loop and
infinite loop, explain her with the help of
infinite loop, explain her with the help of
example.
example.
 
12.  Write an algorithm and a flowchart to find
12.  Write an algorithm and a flowchart to find
sum of n numbers.
sum of n numbers.
 
ANSWER THE FOLLOWING QUESTIONS.
ANSWER THE FOLLOWING QUESTIONS.
 
THANK YOU
THANK YOU
Slide Note
Embed
Share

Learn about the fundamentals of algorithms and flow charts in computer science with a focus on problem-solving techniques, algorithm definition, flow chart symbolism, and conversion between algorithms and flow charts. Explore the intelligence characteristics that set humans apart, illustrated through practical examples like financial decision-making processes. Enhance your understanding of computer systems and organization through this insightful unit.

  • Computer Science
  • Algorithms
  • Flow Charts
  • Problem Solving
  • Intelligence

Uploaded on Jul 12, 2024 | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. Download presentation by click this link. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

E N D

Presentation Transcript


  1. XI Computer Science (083) Board : CBSE Unit 1: Computer Systems and Organisation (CSO) CHAPTER 06 ALGORITHMS AND FLOW CHARTS

  2. XI Computer Science (083) Board : CBSE Unit 1: Computer Systems and Organisation (CSO) Courtesy CBSE

  3. 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) Department of Computer Science, Sainik School Amaravathinagar Cell No: 9431453730 Courtesy CBSE

  4. PROBLEM SOLVING TECHNIQUES

  5. ALGORITHM AND FLOW CHART OBJECTIVES able to define problem; able to define algorithm; write algorithms for simple problems; explain properties of an algorithm; the meaning of flowchart; explain the need of flow chart; explain different symbols used in flow chart; draw flow chart for simple problems; and convert a flow chart into an algorithm and vice versa.

  6. ALGORITHM AND FLOW CHART INTRODUCTION Intelligence characteristics which differentiate a human being from other living creatures on the earth. Basic intelligence covers day to day problem solving and making strategies to handle different situations which keep arising in day to day life. is one of the key

  7. ALGORITHM AND FLOW CHART INTRODUCTION One person goes Bank to withdraw money. After knowing the balance in his account, he/she decides to withdraw the entire amount from his account but he/she has to leave minimum balance in his account.

  8. ALGORITHM AND FLOW CHART INTRODUCTION Here deciding about how much amount he/she may withdraw from the account is one of the example of the basic intelligence. During the process of solving any problem, one tries to find the necessary steps to be taken in a sequence.

  9. ALGORITHM AND FLOW CHART What is Algorithm? Algorithm can be defined as: A sequ ence of activities to be processed for getti ng desired output from a given input.

  10. 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 cl ear stopping point .

  11. MUHAMMAD IBN MUSA AL-KHWARIZMI Mu ammad ibn M s al- Khw rizm (Persian: ; c. 780 Formerly Latinized as Algoritmi, was a Persian scholar who produced works in mathematics, astronomy, & geography under the patronage of the Caliph Al-Ma'mun the Abbasid Caliphate. c. 850), of Around 820 AD he was appointed as the astronomer and head of the library of the Wisdom in Baghdad. House of

  12. 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

  13. 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.

  14. 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.

  15. 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.

  16. PROPERTIES OF ALGORITHM 4) OUTPUT: One (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. always expects output/result

  17. 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.

  18. PROPERTIES OF ALGORITHM Any algorithm should have all these five properties otherwise it will not fulfil the basic objective of solving a problem in finite time. As you have seen in previous examples, every step of an algorithm puts you closer to the solution

  19. ALGORITHM EXAMPLES Let us take one simple day-to-day example by writing algorithm for making, Maggi Noodles as a food. Step 1: Start Step 2: Take pan with water Step 3: Put pan on the burner Step 4: Switch on the gas/burner Step 5: Put magi and masala Step 6: Give two minutes to boil Step 7: Take off the pan Step 8: Take out the magi with the help of fork/spoon Step 9: Put the maggi on the plate and serve it Step 10: Stop.

  20. ALGORITHM EXAMPLES Write an algorithm to print GoodMorning Step 1: Step 2: Step 3: Start Print Good Morning Stop

  21. ALGORITHM EXAMPLES Write an algorithm to find area of a rectangle. Step 1: Step 2: Step 3: Step 4: Step 5: Start Take length and breadth and store them as L and B? Multiply by L and B and store it in area Print area Stop

  22. ALGORITHM EXAMPLES Write an algorithm to check whether he is eligible to vote? (more than or equal to 18 years old). Step 1: Step 2: Step 3: Start Take age and store it in age Check age value, if age >= 18 then go to step 4 else step 5 Print Eligible to vote and go to step 6 Print Not eligible to vote Stop Step 4: Step 5: Step 6:

  23. ALGORITHM EXAMPLES Write an algorithm to check whether given number is +ve, -ve or zero. 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

  24. ALGORITHM EXAMPLES Write an algorithm to check whether given number is +ve, -ve or zero. Step 5: Step 6: Step 7: Step 8: Print Given number is +ve and go to step 8 Print Given number is -ve and go to step 8 Print Given number is zero Stop

  25. FLOWCHART

  26. FLOWCHART The flowchart is a diagram which visually pre sents the flow of data through processing systems. This means by seeing a flow chart o ne can know the operations performed and the sequence of these operations in a syste m. Algorithms are nothing but sequence of steps for solving problems. So a flow chart ca n be used for representing an algorithm. A flowchart, will describe the operations (and in what sequence) to solve a given problem. are required

  27. FLOWCHART A flowchart is a type of diagram that represents an algorithm, process. The flowchart shows the steps as boxes of various kinds, and their order by connecting the boxes with arrows. This diagrammatic representation illustrates a solution model to a given Flowcharts are used in analyzing, designing, documenting or managing a process or program in various fields. workflow or problem.

  28. BUILDING BLOCKS OF FLOW CHART OR COMMON SYMBOLS OF FLOW CHART

  29. BUILDING BLOCKS OF FLOW CHART The Institute (ANSI) set standards for flowcharts and their symbols 1960s. The International Organization for Standardization(ISO) adopted the ANSI symbols in 1970. The current standard was revised in 1985. Generally, flowcharts flow from top to bottom and left to right. American National Standards in the

  30. BUILDING BLOCKS OF FLOW CHART ANSI/ISO Shape Name Description Shows the process's order of operation. A line coming from one symbol and pointing at another. Arrowheads are added if the flow is not the standard top-to-bottom, left- to right. Flowline (Arrowhead)

  31. BUILDING BLOCKS OF FLOW CHART ANSI/ISO Shape Name Description Indicates the beginning and ending of a program or sub-process. Represented as a stadium, oval or rounded (fillet) rectangle. They usually contain the word "Start" or "End", or another phrase signaling the start or end of a process, such as "submit inquiry" product". Terminal or "receive

  32. BUILDING BLOCKS OF FLOW CHART ANSI/ISO Shape Name Description Represents a set of operations that changes value, form, or location of data. Represented as a rectangle Process

  33. BUILDING BLOCKS OF FLOW CHART ANSI/ISO Shape Name Description Shows a conditional operation that determines which one of the two paths the program will take. The operation is commonly a yes/no question or true/false Represented as (rhombus). Decision test. a diamond

  34. BUILDING BLOCKS OF FLOW CHART ANSI/ISO Shape Name Description Indicates the process of inputting and outputting data, as in entering data or displaying Represented as a parallelogram Input / results. Output

  35. BUILDING BLOCKS OF FLOW CHART ANSI/ISO Shape Name Description Indicating information about a step the program. Represented as an open rectangle with a dashed or solid line connecting it to the corresponding symbol in the flowchart. additional Annotation (Comment)

  36. BUILDING BLOCKS OF FLOW CHART ANSI/ISO Shape Name Description Shows /Function which is defined elsewhere. Represented as a rectangle with double- struck vertical edges. named process Predefined Process Functions

  37. Flowchart Line.svg BUILDING BLOCKS OF FLOW CHART ANSI/ISO Shape Name Description Pairs of labelled connectors replace long or confusing lines on a flowchart page. Represented by a small circle with a letter inside. On-page Connector

  38. BUILDING BLOCKS OF FLOW CHART ANSI/ISO Shape Name Description A labelled connector for use when the target is on another page. Represented as a home shaped pentagon. Off-page Connector plate-

  39. BUILDING BLOCKS OF FLOW CHART ANSI/ISO Shape Name Description Storage/ Backup Magnetic Tape used for sec ondary storage/Backup

  40. BUILDING BLOCKS OF FLOW CHART ANSI/ISO Shape Name Description Storage/ Backup Magnetic Disk used for sec ondary storage/Backup

  41. 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 advantages. These advantages are as follows: having many 1. COMMUNICATION. 2. EFFECTIVE ANALYSIS. 3. DOCUMENTATION OF PROGRAM/SYSTEM. 4. EFFICIENT PROGRAM MAINTENANCE. 5. CODING OF THE PROGRAM.

  42. ADVANTAGES OF USING FLOWCHARTS 1. COMMUNICATION: A Flowchart can be used as a better way of communication of the logic of a system and steps involve in the solution, to all concerned particularly to the client of system.

  43. ADVANTAGES OF USING FLOWCHARTS 2. EFFECTIVE ANALYSIS: A flowchart of a problem can be used for effective analysis of the problem.

  44. ADVANTAGES OF USING FLOWCHARTS 3.DOCUMENTATION OF PROGRAM/ SYSTEM: Program flowcharts are a vital part of a good program documentation. Program document is used for various purposes like knowing the components in the program, complexity of the program etc.

  45. ADVANTAGES OF USING FLOWCHARTS 4. EFFICIENT PROGRAM MAINTENANCE: Once a program is developed and becomes operational it needs time to time maintenance. With help of flowchart maintenance become easier.

  46. ADVANTAGES OF USING FLOWCHARTS 5. CODING OF THE PROGRAM: Any design of solution of a problem is finally converted into computer program. Writing code referring the flowchart of the solution become easy.

  47. LIMITATIONS OF USING FLOWCHARTS 1) COMPLEXITY OF LOGIC: If program logic is complex then flowchart of the program becomes complicated. 2) ALTERATIONS AND MODIFICATIONS IN LOGIC: any alterations in the program logic may require redrawing of flowchart completely. 3) REUSE IS NOT POSSIBLE: As the flowchart symbols cannot be typed, always reproduction of flowchart symbols are required.

  48. FLOWCHART EXAMPLES Draw a flowchart to find the simple interest. (Sequence)

  49. FLOWCHART EXAMPLES Draw a flowchart to find bigger number among two numbers (selective)

  50. FLOWCHART EXAMPLES Draw a flow chart to find factorial of any number.

Related


More Related Content

giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#