Chapter 6 algorithms and flow charts

CHAPTER 06
ALGORITHMS AND FLOW CHARTS
Unit 1:
XI
Computer Science (083)
Board : CBSE
• Computer Systems and Organisation
(CSO)
Unit 1:
XI
Computer Science (083)
Board : CBSE
Courtesy CBSE
Computer Systems and Organisation (CSO)
Unit I
10 Theory + 02 Practical)
Praveen M Jigajinni
Prepared by
Courtesy CBSE
Computer Systems and Organisation (CSO)
DCSc & Engg, PGDCA,ADCA,MCA.MSc(IT),Mtech(IT),MPhil (Comp. Sci)
Department of Computer Science, Sainik School Amaravathinagar
Cell No: 9431453730
PROBLEM SOLVING TECHNIQUES
 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.
ALGORITHM AND FLOW CHART
OBJECTIVES
ALGORITHM AND FLOW CHART
Intelligence is one of the key
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.
INTRODUCTION
ALGORITHM AND FLOW CHART
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.
INTRODUCTION
ALGORITHM AND FLOW CHART
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.
INTRODUCTION
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.”
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”.
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
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
ADVANTAGES OF ALGORITHM
The use of algorithms provides a number of
advantages. One of these advantages is in
the development of the procedure itself,
which involves identification of the
processes, major decision points, and
variables necessary to solve the problem.
Developing an algorithm allows and even
forces examination of the solution process
in a rational manner.
ADVANTAGES OF ALGORITHM
Identification of the processes and decision
points reduces the task into a series of
smaller steps of more manageable size.
Problems that would be difficult or
impossible to solve wholesale can be
approached as a series of small, solvable
sub problems. The required specification
aids in the identification and reduction of
subconscious biases. By using an algorithm,
decision-making becomes a more rational
process.
ADVANTAGES OF ALGORITHM
In additional to making the process more
rational, use of an algorithm will make the
process more efficient and more consistent.
Efficiency is an inherent result of the
analysis and specification process.
Consistency comes from both the use of the
same specified process and increased skill in
applying the process. An algorithm serves
as a mnemonic device and helps ensure
that variables or parts of the problem are
not ignored.
ADVANTAGES OF ALGORITHM
Presenting the solution process as an
algorithm allows more precise
communication. Finally, separation of the
procedure steps facilitates division of labor
and development of expertise.
A final benefit of the use of an algorithm
comes from the improvement it makes
possible. If the problem solver does not
know what was done, he or she will not
know what was done wrong.
ADVANTAGES OF ALGORITHM
As time goes by and results are compared
with goals, the existence of a specified
solution process allows identification of
weaknesses and errors in the process.
Reduction of a task to a specified set of
steps or algorithm is an important part of
analysis, control, and evaluation.
DISADVANTAGES OF ALGORITHM
One disadvantage of algorithms is that they
always terminate, which means there are
some computational procedures—occasionally
even useful ones—which are not algorithms.
Furthermore, all computational procedures,
whether they terminate or not, can only give
computable results, so you cannot, for
example, design a program which determines a
busy beaver number more quickly than could
be done by actually running the associated
types of Turing machines.
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.
ALGORITHM EXAMPLES
Write an algorithm to print “Good Morning‟
Step 1: Start
Step 2: Print “Good Morning‟
Step 3: Stop
ALGORITHM EXAMPLES
Write an algorithm to find area of a rectangle.
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
Write an algorithm to check whether he is
eligible to vote? (more than or equal to 18
years old).
Step 1: Start
Step 2: Take age and store it in age
Step 3: Check age value, if age >= 18 then go
to step 4 else step 5
Step 4: Print “Eligible to vote” and go to
step 6
Step 5: Print “Not eligible to vote”
Step 6: Stop
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
ALGORITHM EXAMPLES
Write an algorithm to check whether given
number is +ve, -ve or zero.
Step 5: Print “Given number is +ve”and go
to step 8
Step 6: Print “Given number is -ve” and go
to step 8
Step 7: Print “Given number is zero”
Step 8: Stop
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) are required
to solve a given problem.
FLOWCHART
A flowchart is a type of diagram that
represents an algorithm, workflow or
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 problem.
Flowcharts are used in analyzing, designing,
documenting or managing a process or
program in various fields.
FLOWCHART
BUILDING BLOCKS
OF
FLOW CHART
OR
COMMON SYMBOLS
OF
FLOW CHART
The American National Standards
Institute (ANSI) set standards for flowcharts
and their symbols in the
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.
BUILDING BLOCKS OF FLOW CHART
BUILDING BLOCKS OF FLOW CHART
ANSI/ISO
Shape
Name Description
Flowline
(Arrowhead)
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.
BUILDING BLOCKS OF FLOW CHART
ANSI/ISO
Shape
Name Description
Terminal
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" or "receive
product".
BUILDING BLOCKS OF FLOW CHART
ANSI/ISO
Shape
Name Description
Process
Represents a set of operations that
changes value, form, or location of
data. Represented as a rectangle
BUILDING BLOCKS OF FLOW CHART
ANSI/ISO
Shape
Name Description
Decision
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 test.
Represented as a diamond
(rhombus).
BUILDING BLOCKS OF FLOW CHART
ANSI/ISO
Shape
Name Description
Input /
Output
Indicates the process of inputting
and outputting data, as in entering
data or displaying results.
Represented as a parallelogram
BUILDING BLOCKS OF FLOW CHART
ANSI/ISO
Shape
Name Description
Annotation
(Comment)
Indicating additional
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.
BUILDING BLOCKS OF FLOW CHART
ANSI/ISO
Shape
Name Description
Predefined
Process
Functions
Shows named process
/Function which is defined
elsewhere. Represented as
a rectangle with double-
struck vertical edges.
BUILDING BLOCKS OF FLOW CHART
ANSI/ISO
Shape
Name Description
On-page
Connector
Pairs of labelled connectors
replace long or confusing
lines on a flowchart page.
Represented by a small
circle with a letter inside.
BUILDING BLOCKS OF FLOW CHART
ANSI/ISO
Shape
Name Description
Off-page
Connector
A labelled connector for
use when the target is on
another page. Represented
as a home plate-
shaped pentagon.
BUILDING BLOCKS OF FLOW CHART
ANSI/ISO
Shape
Name Description
Storage/
Backup
Magnetic Tape used for sec
ondary storage/Backup
BUILDING BLOCKS OF FLOW CHART
ANSI/ISO
Shape
Name Description
Storage/
Backup
Magnetic Disk used for sec
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:
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.
ADVANTAGES OF USING FLOWCHARTS
2. EFFECTIVE ANALYSIS:
A flowchart of a problem can be used for
effective analysis of the problem.
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.
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.
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.
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.
FLOWCHART EXAMPLES
Draw a flowchart to find the simple interest.
(Sequence)
FLOWCHART EXAMPLES
Draw a flowchart to find bigger number
among two numbers (selective)
FLOWCHART EXAMPLES
Draw a flow chart to find factorial of any
number.
FLOWCHART EXAMPLES
FLOWCHART EXAMPLES
Draw a flow chart to print the number from 1
to N.
FLOWCHART EXAMPLES
FLOWCHART EXAMPLES
Draw a flow chart to find biggest number
among N numbers.
FLOWCHART EXAMPLES
CLASS TEST
1. A step by step method for solving a problem
using English Language
(a) program (b) Flowchart
(c) statement (d) Algorithm
2. Set of statements is executed based upon
conditional test.
(a) Looping (b) Selective
(c) Sequence (d) None
MULTIPLE CHOICE QUESTIONS
Time: 40 Min Max Marks 20
3. Set of statements is executed again and again
based upon conditional test.
(a) Looping (b) Selective
(c) Sequence (d) None
4. The graphical representation of algorithm is
(a) program (b) Flowchart
(c) statement (d) Algorithm
5. All instructions are executed one after other.
(a) Looping (b) Selective
(c) Sequence (d) None
MULTIPLE CHOICE QUESTIONS
1. Define Algorithm.
2. Define Flowchart.
3. Write an algorithm to find the sum of two
numbers.
4. Write an algorithm to find the area of a
triangle.
5. Write an algorithm to find whether given
number is odd or even.
ANSWER THE FOLLOWING QUESTIONS.
6. Write an algorithm to find the sum of all even
number up to given number.
7. Draw a flowchart to find the area of a circle.
9. Draw a flowchart to find the smallest number
among n numbers.
ANSWER THE FOLLOWING QUESTIONS.
10. Draw a flowchart to find the sum of all
multiples of 5 up to given number.
11. Mona is confused about finite loop and
infinite loop, explain her with the help of
example.
12. Write an algorithm and a flowchart to find
sum of n numbers.
ANSWER THE FOLLOWING QUESTIONS.
THANK YOU
1 von 68

Recomendados

Programming Fundamentals von
Programming FundamentalsProgramming Fundamentals
Programming FundamentalsTrivuz ত্রিভুজ
24.7K views42 Folien
Flowchart and algorithm von
Flowchart and algorithmFlowchart and algorithm
Flowchart and algorithmDHANIK VIKRANT
732 views28 Folien
pseudocode and Flowchart von
pseudocode and Flowchartpseudocode and Flowchart
pseudocode and FlowchartALI RAZA
1.4K views30 Folien
ppt of flowchart von
ppt of flowchartppt of flowchart
ppt of flowchart140120109032
38.9K views19 Folien
Algorithm and flowchart von
Algorithm and flowchartAlgorithm and flowchart
Algorithm and flowchartRabin BK
10.7K views17 Folien
What is an algorithm? von
What is an algorithm?What is an algorithm?
What is an algorithm?Angela DeHart
18.4K views33 Folien

Más contenido relacionado

Was ist angesagt?

Pseudocode-Flowchart von
Pseudocode-FlowchartPseudocode-Flowchart
Pseudocode-Flowchartlotlot
38.5K views14 Folien
pseudo code basics von
pseudo code basicspseudo code basics
pseudo code basicsSabik T S
32.3K views29 Folien
Algorithm and flowchart von
Algorithm and flowchartAlgorithm and flowchart
Algorithm and flowchartElizabeth de Leon Aler
87.3K views9 Folien
Pseudocode algorithim flowchart von
Pseudocode algorithim flowchartPseudocode algorithim flowchart
Pseudocode algorithim flowchartfika sweety
7.9K views24 Folien
Unit 1. Problem Solving with Computer von
Unit 1. Problem Solving with Computer   Unit 1. Problem Solving with Computer
Unit 1. Problem Solving with Computer Ashim Lamichhane
35.3K views55 Folien
Algorithms and Flowcharts von
Algorithms and FlowchartsAlgorithms and Flowcharts
Algorithms and FlowchartsDeva Singh
309.8K views31 Folien

Was ist angesagt?(20)

Pseudocode-Flowchart von lotlot
Pseudocode-FlowchartPseudocode-Flowchart
Pseudocode-Flowchart
lotlot38.5K views
pseudo code basics von Sabik T S
pseudo code basicspseudo code basics
pseudo code basics
Sabik T S32.3K views
Pseudocode algorithim flowchart von fika sweety
Pseudocode algorithim flowchartPseudocode algorithim flowchart
Pseudocode algorithim flowchart
fika sweety7.9K views
Unit 1. Problem Solving with Computer von Ashim Lamichhane
Unit 1. Problem Solving with Computer   Unit 1. Problem Solving with Computer
Unit 1. Problem Solving with Computer
Ashim Lamichhane35.3K views
Algorithms and Flowcharts von Deva Singh
Algorithms and FlowchartsAlgorithms and Flowcharts
Algorithms and Flowcharts
Deva Singh309.8K views
Introduction to Java Programming von Ravi Kant Sahu
Introduction to Java ProgrammingIntroduction to Java Programming
Introduction to Java Programming
Ravi Kant Sahu31.1K views
10. switch case von Way2itech
10. switch case10. switch case
10. switch case
Way2itech7.9K views
Flowchart symbols meaning explained von Eliza Wright
Flowchart symbols meaning explainedFlowchart symbols meaning explained
Flowchart symbols meaning explained
Eliza Wright10.2K views
Algorithm and flowchart von Shivam Sharma
Algorithm and flowchart Algorithm and flowchart
Algorithm and flowchart
Shivam Sharma168 views
Algorithms Lecture 1: Introduction to Algorithms von Benha University
Algorithms Lecture 1: Introduction to AlgorithmsAlgorithms Lecture 1: Introduction to Algorithms
Algorithms Lecture 1: Introduction to Algorithms
Benha University3.3K views
algo von Rao Khan
algoalgo
algo
Rao Khan1.5K views

Similar a Chapter 6 algorithms and flow charts

11 Unit 1 Problem Solving Techniques von
11  Unit 1 Problem Solving Techniques11  Unit 1 Problem Solving Techniques
11 Unit 1 Problem Solving Techniquespraveenjigajinni
2.6K views60 Folien
Lect 3-4 Zaheer Abbas von
Lect 3-4 Zaheer AbbasLect 3-4 Zaheer Abbas
Lect 3-4 Zaheer AbbasInformation Technology Center
1.5K views29 Folien
Unit 1-problem solving with algorithm von
Unit 1-problem solving with algorithmUnit 1-problem solving with algorithm
Unit 1-problem solving with algorithmrajkumar1631010038
6.9K views26 Folien
AOA Week 01.ppt von
AOA Week 01.pptAOA Week 01.ppt
AOA Week 01.pptINAM352782
3 views21 Folien
Design and Analysis Algorithms.pdf von
Design and Analysis Algorithms.pdfDesign and Analysis Algorithms.pdf
Design and Analysis Algorithms.pdfHarshNagda5
47 views116 Folien
Problem-solving and design 1.pptx von
Problem-solving and design 1.pptxProblem-solving and design 1.pptx
Problem-solving and design 1.pptxTadiwaMawere
15 views105 Folien

Similar a Chapter 6 algorithms and flow charts(20)

11 Unit 1 Problem Solving Techniques von praveenjigajinni
11  Unit 1 Problem Solving Techniques11  Unit 1 Problem Solving Techniques
11 Unit 1 Problem Solving Techniques
praveenjigajinni2.6K views
Design and Analysis Algorithms.pdf von HarshNagda5
Design and Analysis Algorithms.pdfDesign and Analysis Algorithms.pdf
Design and Analysis Algorithms.pdf
HarshNagda547 views
Problem-solving and design 1.pptx von TadiwaMawere
Problem-solving and design 1.pptxProblem-solving and design 1.pptx
Problem-solving and design 1.pptx
TadiwaMawere15 views
Logic Development and Algorithm. von NandiniSidana
Logic Development and Algorithm.Logic Development and Algorithm.
Logic Development and Algorithm.
NandiniSidana335 views
Software develop.... von GCWUS
Software develop.... Software develop....
Software develop....
GCWUS412 views
Unit 1 python (2021 r) von praveena p
Unit 1 python (2021 r)Unit 1 python (2021 r)
Unit 1 python (2021 r)
praveena p528 views
What is algorithm von lilyMalar1
What is algorithmWhat is algorithm
What is algorithm
lilyMalar1158 views
chapter 1 von yatheesha
chapter 1chapter 1
chapter 1
yatheesha4.4K views

Más de praveenjigajinni

Chapter 09 design and analysis of algorithms von
Chapter 09  design and analysis of algorithmsChapter 09  design and analysis of algorithms
Chapter 09 design and analysis of algorithmspraveenjigajinni
8K views96 Folien
Chapter 08 data file handling von
Chapter 08 data file handlingChapter 08 data file handling
Chapter 08 data file handlingpraveenjigajinni
23.8K views158 Folien
Chapter 07 inheritance von
Chapter 07 inheritanceChapter 07 inheritance
Chapter 07 inheritancepraveenjigajinni
1.9K views41 Folien
Chapter 06 constructors and destructors von
Chapter 06 constructors and destructorsChapter 06 constructors and destructors
Chapter 06 constructors and destructorspraveenjigajinni
1.6K views29 Folien
Chapter 05 classes and objects von
Chapter 05 classes and objectsChapter 05 classes and objects
Chapter 05 classes and objectspraveenjigajinni
2.8K views67 Folien
Chapter 04 object oriented programming von
Chapter 04 object oriented programmingChapter 04 object oriented programming
Chapter 04 object oriented programmingpraveenjigajinni
1.6K views40 Folien

Más de praveenjigajinni(20)

Chapter 09 design and analysis of algorithms von praveenjigajinni
Chapter 09  design and analysis of algorithmsChapter 09  design and analysis of algorithms
Chapter 09 design and analysis of algorithms
praveenjigajinni8K views
Chapter 06 constructors and destructors von praveenjigajinni
Chapter 06 constructors and destructorsChapter 06 constructors and destructors
Chapter 06 constructors and destructors
praveenjigajinni1.6K views
Chapter 04 object oriented programming von praveenjigajinni
Chapter 04 object oriented programmingChapter 04 object oriented programming
Chapter 04 object oriented programming
praveenjigajinni1.6K views
Chapter 7 basics of computational thinking von praveenjigajinni
Chapter 7 basics of computational thinkingChapter 7 basics of computational thinking
Chapter 7 basics of computational thinking
praveenjigajinni3.7K views
Chapter 3 cloud computing and intro parrallel computing von praveenjigajinni
Chapter 3 cloud computing and intro parrallel computingChapter 3 cloud computing and intro parrallel computing
Chapter 3 cloud computing and intro parrallel computing
praveenjigajinni1.2K views

Último

Psychology KS4 von
Psychology KS4Psychology KS4
Psychology KS4WestHatch
76 views4 Folien
Class 10 English notes 23-24.pptx von
Class 10 English notes 23-24.pptxClass 10 English notes 23-24.pptx
Class 10 English notes 23-24.pptxTARIQ KHAN
125 views53 Folien
Lecture: Open Innovation von
Lecture: Open InnovationLecture: Open Innovation
Lecture: Open InnovationMichal Hron
99 views56 Folien
Collective Bargaining and Understanding a Teacher Contract(16793704.1).pptx von
Collective Bargaining and Understanding a Teacher Contract(16793704.1).pptxCollective Bargaining and Understanding a Teacher Contract(16793704.1).pptx
Collective Bargaining and Understanding a Teacher Contract(16793704.1).pptxCenter for Integrated Training & Education
91 views57 Folien
AUDIENCE - BANDURA.pptx von
AUDIENCE - BANDURA.pptxAUDIENCE - BANDURA.pptx
AUDIENCE - BANDURA.pptxiammrhaywood
77 views44 Folien
Use of Probiotics in Aquaculture.pptx von
Use of Probiotics in Aquaculture.pptxUse of Probiotics in Aquaculture.pptx
Use of Probiotics in Aquaculture.pptxAKSHAY MANDAL
95 views15 Folien

Último(20)

Psychology KS4 von WestHatch
Psychology KS4Psychology KS4
Psychology KS4
WestHatch76 views
Class 10 English notes 23-24.pptx von TARIQ KHAN
Class 10 English notes 23-24.pptxClass 10 English notes 23-24.pptx
Class 10 English notes 23-24.pptx
TARIQ KHAN125 views
Lecture: Open Innovation von Michal Hron
Lecture: Open InnovationLecture: Open Innovation
Lecture: Open Innovation
Michal Hron99 views
Use of Probiotics in Aquaculture.pptx von AKSHAY MANDAL
Use of Probiotics in Aquaculture.pptxUse of Probiotics in Aquaculture.pptx
Use of Probiotics in Aquaculture.pptx
AKSHAY MANDAL95 views
Dance KS5 Breakdown von WestHatch
Dance KS5 BreakdownDance KS5 Breakdown
Dance KS5 Breakdown
WestHatch69 views
Classification of crude drugs.pptx von GayatriPatra14
Classification of crude drugs.pptxClassification of crude drugs.pptx
Classification of crude drugs.pptx
GayatriPatra1483 views
11.30.23 Poverty and Inequality in America.pptx von mary850239
11.30.23 Poverty and Inequality in America.pptx11.30.23 Poverty and Inequality in America.pptx
11.30.23 Poverty and Inequality in America.pptx
mary850239149 views
11.28.23 Social Capital and Social Exclusion.pptx von mary850239
11.28.23 Social Capital and Social Exclusion.pptx11.28.23 Social Capital and Social Exclusion.pptx
11.28.23 Social Capital and Social Exclusion.pptx
mary850239291 views
Create a Structure in VBNet.pptx von Breach_P
Create a Structure in VBNet.pptxCreate a Structure in VBNet.pptx
Create a Structure in VBNet.pptx
Breach_P72 views
EIT-Digital_Spohrer_AI_Intro 20231128 v1.pptx von ISSIP
EIT-Digital_Spohrer_AI_Intro 20231128 v1.pptxEIT-Digital_Spohrer_AI_Intro 20231128 v1.pptx
EIT-Digital_Spohrer_AI_Intro 20231128 v1.pptx
ISSIP359 views
American Psychological Association 7th Edition.pptx von SamiullahAfridi4
American Psychological Association  7th Edition.pptxAmerican Psychological Association  7th Edition.pptx
American Psychological Association 7th Edition.pptx
SamiullahAfridi482 views
JiscOAWeek_LAIR_slides_October2023.pptx von Jisc
JiscOAWeek_LAIR_slides_October2023.pptxJiscOAWeek_LAIR_slides_October2023.pptx
JiscOAWeek_LAIR_slides_October2023.pptx
Jisc93 views
Scope of Biochemistry.pptx von shoba shoba
Scope of Biochemistry.pptxScope of Biochemistry.pptx
Scope of Biochemistry.pptx
shoba shoba126 views

Chapter 6 algorithms and flow charts

  • 1. CHAPTER 06 ALGORITHMS AND FLOW CHARTS Unit 1: XI Computer Science (083) Board : CBSE • Computer Systems and Organisation (CSO)
  • 2. Unit 1: XI Computer Science (083) Board : CBSE Courtesy CBSE Computer Systems and Organisation (CSO)
  • 3. Unit I 10 Theory + 02 Practical) Praveen M Jigajinni Prepared by Courtesy CBSE Computer Systems and Organisation (CSO) DCSc & Engg, PGDCA,ADCA,MCA.MSc(IT),Mtech(IT),MPhil (Comp. Sci) Department of Computer Science, Sainik School Amaravathinagar Cell No: 9431453730
  • 5.  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. ALGORITHM AND FLOW CHART OBJECTIVES
  • 6. ALGORITHM AND FLOW CHART Intelligence is one of the key 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. INTRODUCTION
  • 7. ALGORITHM AND FLOW CHART 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. INTRODUCTION
  • 8. ALGORITHM AND FLOW CHART 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. INTRODUCTION
  • 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 – 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.
  • 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 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.
  • 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. ADVANTAGES OF ALGORITHM The use of algorithms provides a number of advantages. One of these advantages is in the development of the procedure itself, which involves identification of the processes, major decision points, and variables necessary to solve the problem. Developing an algorithm allows and even forces examination of the solution process in a rational manner.
  • 20. ADVANTAGES OF ALGORITHM Identification of the processes and decision points reduces the task into a series of smaller steps of more manageable size. Problems that would be difficult or impossible to solve wholesale can be approached as a series of small, solvable sub problems. The required specification aids in the identification and reduction of subconscious biases. By using an algorithm, decision-making becomes a more rational process.
  • 21. ADVANTAGES OF ALGORITHM In additional to making the process more rational, use of an algorithm will make the process more efficient and more consistent. Efficiency is an inherent result of the analysis and specification process. Consistency comes from both the use of the same specified process and increased skill in applying the process. An algorithm serves as a mnemonic device and helps ensure that variables or parts of the problem are not ignored.
  • 22. ADVANTAGES OF ALGORITHM Presenting the solution process as an algorithm allows more precise communication. Finally, separation of the procedure steps facilitates division of labor and development of expertise. A final benefit of the use of an algorithm comes from the improvement it makes possible. If the problem solver does not know what was done, he or she will not know what was done wrong.
  • 23. ADVANTAGES OF ALGORITHM As time goes by and results are compared with goals, the existence of a specified solution process allows identification of weaknesses and errors in the process. Reduction of a task to a specified set of steps or algorithm is an important part of analysis, control, and evaluation.
  • 24. DISADVANTAGES OF ALGORITHM One disadvantage of algorithms is that they always terminate, which means there are some computational procedures—occasionally even useful ones—which are not algorithms. Furthermore, all computational procedures, whether they terminate or not, can only give computable results, so you cannot, for example, design a program which determines a busy beaver number more quickly than could be done by actually running the associated types of Turing machines.
  • 25. 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.
  • 26. ALGORITHM EXAMPLES Write an algorithm to print “Good Morning‟ Step 1: Start Step 2: Print “Good Morning‟ Step 3: Stop
  • 27. ALGORITHM EXAMPLES Write an algorithm to find area of a rectangle. 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
  • 28. ALGORITHM EXAMPLES Write an algorithm to check whether he is eligible to vote? (more than or equal to 18 years old). Step 1: Start Step 2: Take age and store it in age Step 3: Check age value, if age >= 18 then go to step 4 else step 5 Step 4: Print “Eligible to vote” and go to step 6 Step 5: Print “Not eligible to vote” Step 6: Stop
  • 29. 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
  • 30. ALGORITHM EXAMPLES Write an algorithm to check whether given number is +ve, -ve or zero. Step 5: Print “Given number is +ve”and go to step 8 Step 6: Print “Given number is -ve” and go to step 8 Step 7: Print “Given number is zero” Step 8: Stop
  • 32. 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) are required to solve a given problem. FLOWCHART
  • 33. A flowchart is a type of diagram that represents an algorithm, workflow or 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 problem. Flowcharts are used in analyzing, designing, documenting or managing a process or program in various fields. FLOWCHART
  • 35. The American National Standards Institute (ANSI) set standards for flowcharts and their symbols in the 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. BUILDING BLOCKS OF FLOW CHART
  • 36. BUILDING BLOCKS OF FLOW CHART ANSI/ISO Shape Name Description Flowline (Arrowhead) 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.
  • 37. BUILDING BLOCKS OF FLOW CHART ANSI/ISO Shape Name Description Terminal 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" or "receive product".
  • 38. BUILDING BLOCKS OF FLOW CHART ANSI/ISO Shape Name Description Process Represents a set of operations that changes value, form, or location of data. Represented as a rectangle
  • 39. BUILDING BLOCKS OF FLOW CHART ANSI/ISO Shape Name Description Decision 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 test. Represented as a diamond (rhombus).
  • 40. BUILDING BLOCKS OF FLOW CHART ANSI/ISO Shape Name Description Input / Output Indicates the process of inputting and outputting data, as in entering data or displaying results. Represented as a parallelogram
  • 41. BUILDING BLOCKS OF FLOW CHART ANSI/ISO Shape Name Description Annotation (Comment) Indicating additional 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.
  • 42. BUILDING BLOCKS OF FLOW CHART ANSI/ISO Shape Name Description Predefined Process Functions Shows named process /Function which is defined elsewhere. Represented as a rectangle with double- struck vertical edges.
  • 43. BUILDING BLOCKS OF FLOW CHART ANSI/ISO Shape Name Description On-page Connector Pairs of labelled connectors replace long or confusing lines on a flowchart page. Represented by a small circle with a letter inside.
  • 44. BUILDING BLOCKS OF FLOW CHART ANSI/ISO Shape Name Description Off-page Connector A labelled connector for use when the target is on another page. Represented as a home plate- shaped pentagon.
  • 45. BUILDING BLOCKS OF FLOW CHART ANSI/ISO Shape Name Description Storage/ Backup Magnetic Tape used for sec ondary storage/Backup
  • 46. BUILDING BLOCKS OF FLOW CHART ANSI/ISO Shape Name Description Storage/ Backup Magnetic Disk used for sec ondary storage/Backup
  • 47. 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.
  • 48. 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.
  • 49. ADVANTAGES OF USING FLOWCHARTS 2. EFFECTIVE ANALYSIS: A flowchart of a problem can be used for effective analysis of the problem.
  • 50. 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.
  • 51. 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.
  • 52. 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.
  • 53. 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.
  • 54. FLOWCHART EXAMPLES Draw a flowchart to find the simple interest. (Sequence)
  • 55. FLOWCHART EXAMPLES Draw a flowchart to find bigger number among two numbers (selective)
  • 56. FLOWCHART EXAMPLES Draw a flow chart to find factorial of any number.
  • 58. FLOWCHART EXAMPLES Draw a flow chart to print the number from 1 to N.
  • 60. FLOWCHART EXAMPLES Draw a flow chart to find biggest number among N numbers.
  • 63. 1. A step by step method for solving a problem using English Language (a) program (b) Flowchart (c) statement (d) Algorithm 2. Set of statements is executed based upon conditional test. (a) Looping (b) Selective (c) Sequence (d) None MULTIPLE CHOICE QUESTIONS Time: 40 Min Max Marks 20
  • 64. 3. Set of statements is executed again and again based upon conditional test. (a) Looping (b) Selective (c) Sequence (d) None 4. The graphical representation of algorithm is (a) program (b) Flowchart (c) statement (d) Algorithm 5. All instructions are executed one after other. (a) Looping (b) Selective (c) Sequence (d) None MULTIPLE CHOICE QUESTIONS
  • 65. 1. Define Algorithm. 2. Define Flowchart. 3. Write an algorithm to find the sum of two numbers. 4. Write an algorithm to find the area of a triangle. 5. Write an algorithm to find whether given number is odd or even. ANSWER THE FOLLOWING QUESTIONS.
  • 66. 6. Write an algorithm to find the sum of all even number up to given number. 7. Draw a flowchart to find the area of a circle. 9. Draw a flowchart to find the smallest number among n numbers. ANSWER THE FOLLOWING QUESTIONS.
  • 67. 10. Draw a flowchart to find the sum of all multiples of 5 up to given number. 11. Mona is confused about finite loop and infinite loop, explain her with the help of example. 12. Write an algorithm and a flowchart to find sum of n numbers. ANSWER THE FOLLOWING QUESTIONS.