SlideShare una empresa de Scribd logo
1 de 34
1
Subject : C.P.U
Topic: Algorithms and Flowchart
2
Name of Students in Group:
ALGORITHMS AND
FLOWCHARTS
Program design
 Program Design Process has 2 phases:
 Problem Solving Phase
 Creates an algorithm that solves the
problem
 Implementation (Coding) Phase
 Translates the algorithm into a
programming language
4
Algorithm
Problem Program
Algorithms
 An algorithm is a finite set of steps defining the
solution of a particular problem.
 Need not to belong one particular language
 Sequence of English statements can also be
algorithm
 It is not a computer program
 An algorithm can be expressed in English like
language called pseudo code, in a programming
language or in the form of flowchart.
5
Algorithm Vs Program
 What is the difference between an algorithm and a program?
 a program is an implementation of an algorithm to be run on a
specific computer and operating system.
 an algorithm is more abstract – it does not deal with machine
specific details – think of it as a method to solve a problem.
• What is good algorithm?
Efficient algorithms are good, we generally measure efficiency of an
algorithm on the basis of:
1. Time: algorithm should take minimum time to execute.
2. Space: algorithm should use less memory.
6
Algorithm Specification
Every algorithm must satisfy the following criteria:
 Input. Zero or more quantities are externally supplied.
 Output. At least one quantity is produced.
 Definiteness. Each instruction must be clear and
unambiguous(Unique meaning).
 Finiteness. An algorithm terminates in a finite
number of steps.
 Effectiveness. Every instruction must be basic enough
to be carried out than, means not so complex.
7
8
Informal definition of an algorithm
9
Finding the largest integer
among five integers
10
Defining actions in Find Largest algorithm
11
12
Example 1
Write an algorithm that finds the
average of two numbers
Solution:
Average Of Two
Input: Two numbers
1. Add the two numbers
2. Divide the result by 2
3. Return the result by step 2 2
End
Group 13
Example 2
Write an algorithm to change a numeric
grade to a pass/fail grade.
Solution:
Pass/Fail Grade
Input: One number
1. if (the number is greater than or equal to 40)
then
1.1 Set the grade to “pass”
else
1.2 Set the grade to “fail”
End if
2. Return the grade
End
14
Example 3
Write an algorithm for grading System
by following method.
Marks range Grade
>=80 A
>=70 & <80 B
>=60 & <70 C
>=50 & <60 D
<50 F
15
Algorithm For Grade
Input: One number
1. if (the number is between 80 and 100, inclusive)
then
1.1 Set the grade to “A”
End if
2. if (the number is between 70 and 79, inclusive)
then
2.1 Set the grade to “B”
End if
Algorithm for Grading
Continues on the next slide
Solution
16
3. if (the number is between 60 and 69, inclusive)
then
3.1 Set the grade to “C”
End if
4. if (the number is between 50 and 59, inclusive)
then
4.1 Set the grade to “D”
End if
5. If (the number is less than 50)
then
5.1 Set the grade to “F”
End if
6. Return the grade
End
Advantages Of Algorithm
 It provides the core solution to a given problem. This
solution can be implemented on a computer system
using any programming language of user’s choice.
 It facilitates program development by acting as a
design document or a blueprint of a given problem
solution.
 It ensures easy comprehension of a problem solution
as compared to an equivalent computer program.
 It eases identification and removal of logical errors in
a program.
 It facilitates algorithm analysis to find out the most
efficient solution to a given problem.
17
Disadvantages Of
Algorithm
 In large algorithms, the flow of program control becomes difficult
to track.
 Algorithms lack visual representation of programming constructs
like flowcharts; thus, understanding the logic becomes relatively
difficult.
18
Flowchart
A graphical representation of an algorithm, often
used in the design phase of programming to work
out the logical flow of a program.
 Visual way to represent the information flow
 Make our logic more clear
 Help during writing of program
 Make testing and debugging easy
19
20
Flowchart or program
constructs
 Sequence: The order of execution, this typically refers to
the order in which the code will execute. Normally code
executes line by line, so line 1 then 2 then 3 and so on.
 Selection: Selection, like branching, is a method of
controlling the execution sequence, you can create large
control blocks, using if statements testing a condition, or
switch statements evaluating a variable etc to control and
change the execution of the program depending on this
environment and changing variables.
 Iteration (Repetition): Iteration is typically used to refer to
collections and arrays of variables and data. Repeating set
of instruction. Counting from 1 to 10, you are iterating
over the first 10 numbers. for, while, do-while loops will be
implemented for iteration.
21
Flowchart Constructs
22
Flowchart Constructs
(cont..)
23
24
Flowchart Constructs
(cont..)
Example-1
Write an algorithm and draw a flowchart
that will read the two sides of a
rectangle and calculate its area.
Algorithm
 Step 1: Start
 Step 2: Take Width and Length as input
 Step 3: Calculate Area by Width* Length
 Step 4: Print Area.
 Step 5: End
25
Example-1
 Step 1: Start
 Step 2: Input W,L
 Step 3: A  L x W
 Step 4: Print A
 Step 5: End
26
START
Input
W, L
A L x W
STOP
Print
A
Example-2
 Write an Pseudo code and draw a
flowchart that will take marks of four
subjects and calculate the average.
Then if average marks are greater than
50 then print PASS otherwise print FAIL.
27
Example-2
28
Step 1: Start
Step 2: Input M1,M2,M3,M4
Step 3: AVG 
(M1+M2+M3+M4)/4
Step 4: if (AVG <50) then
Print “FAIL”
else
Print “PASS”
endif
Step 5: End
START
Input
M1,M2,M3,M4
AVG(M1+M2+M3+M4)/4
IS
AVG<50
STOP
YN
Print
“PASS”
Print
“FAIL”
Example-3
 Write an algorithm and draw a
flowchart to convert the length in
feet to centimeter.
29
Example-3
Algorithm
 Step 1: Start
 Step 2: Input Lft
 Step 3: Lcm  Lft x 30
 Step 4: Print Lcm
 Step 5: End
30
START
Input
Lft
Lcm Lft x 30
Print
Lcm
STOP
Flowchart
Example-4
 Write an algorithm and draw a flowchart
that will calculate the roots of a quadratic
equation
 Hint: d = sqrt ( ), and the roots are:
x1 = (–b + d)/2a and x2 = (–b – d)/2a
2
0ax bx c  
2
4b ac
31
Example-4
Algorithm:
 Step 1: Start
 Step 2: Input a, b, c
 Step 3: d  sqrt ( )
 Step 4: x1  (–b + d) / (2 x a)
 Step 5: x2  (–b – d) / (2 x a)
 Step 6: Print x1, x2
 Step 7: End
4b b a c   
32
START
Input
a, b, c
d  sqrt(b x b – 4 x a x c)
Print
x1 ,x2
STOP
x1 (–b + d) / (2 x a)
X2 (–b – d) / (2 x a)
Flow Chart`s Limitation
 For very large program, flow chart goes
for many pages
 Costly to draw flow charts for large
program
 Difficult to modify
33
Algorithm and flowchart

Más contenido relacionado

La actualidad más candente

What is an algorithm?
What is an algorithm?What is an algorithm?
What is an algorithm?Angela DeHart
 
Our presentation on algorithm design
Our presentation on algorithm designOur presentation on algorithm design
Our presentation on algorithm designNahid Hasan
 
Algorithm and flowchart
Algorithm and flowchart Algorithm and flowchart
Algorithm and flowchart Shivam Sharma
 
Algorithm and Programming (Introduction of Algorithms)
Algorithm and Programming (Introduction of Algorithms)Algorithm and Programming (Introduction of Algorithms)
Algorithm and Programming (Introduction of Algorithms)Adam Mukharil Bachtiar
 
Unit 1-problem solving with algorithm
Unit 1-problem solving with algorithmUnit 1-problem solving with algorithm
Unit 1-problem solving with algorithmrajkumar1631010038
 
Chapter 6 algorithms and flow charts
Chapter 6  algorithms and flow chartsChapter 6  algorithms and flow charts
Chapter 6 algorithms and flow chartsPraveen M Jigajinni
 
Basics of c++ Programming Language
Basics of c++ Programming LanguageBasics of c++ Programming Language
Basics of c++ Programming LanguageAhmad Idrees
 
Data Structures and Algorithm - Module 1.pptx
Data Structures and Algorithm - Module 1.pptxData Structures and Algorithm - Module 1.pptx
Data Structures and Algorithm - Module 1.pptxEllenGrace9
 
Flowchart and algorithem
Flowchart and algorithemFlowchart and algorithem
Flowchart and algorithemehsanullah786
 
Introduction to C programming
Introduction to C programmingIntroduction to C programming
Introduction to C programmingRokonuzzaman Rony
 
Basic structure of C++ program
Basic structure of C++ programBasic structure of C++ program
Basic structure of C++ programmatiur rahman
 
Unit 1. Problem Solving with Computer
Unit 1. Problem Solving with Computer   Unit 1. Problem Solving with Computer
Unit 1. Problem Solving with Computer Ashim Lamichhane
 
What is programming what are its benefits
What is programming  what are its benefits What is programming  what are its benefits
What is programming what are its benefits Vijay Singh Khatri
 
Programming flowcharts for C Language
Programming flowcharts for C LanguageProgramming flowcharts for C Language
Programming flowcharts for C LanguageAryan Ajmer
 
DESIGN AND ANALYSIS OF ALGORITHMS
DESIGN AND ANALYSIS OF ALGORITHMSDESIGN AND ANALYSIS OF ALGORITHMS
DESIGN AND ANALYSIS OF ALGORITHMSGayathri Gaayu
 

La actualidad más candente (20)

What is an algorithm?
What is an algorithm?What is an algorithm?
What is an algorithm?
 
Our presentation on algorithm design
Our presentation on algorithm designOur presentation on algorithm design
Our presentation on algorithm design
 
Algorithm and flowchart
Algorithm and flowchart Algorithm and flowchart
Algorithm and flowchart
 
Algorithm Introduction
Algorithm IntroductionAlgorithm Introduction
Algorithm Introduction
 
Algorithm and Programming (Introduction of Algorithms)
Algorithm and Programming (Introduction of Algorithms)Algorithm and Programming (Introduction of Algorithms)
Algorithm and Programming (Introduction of Algorithms)
 
Algorithm
AlgorithmAlgorithm
Algorithm
 
Pseudocode
PseudocodePseudocode
Pseudocode
 
Unit 1-problem solving with algorithm
Unit 1-problem solving with algorithmUnit 1-problem solving with algorithm
Unit 1-problem solving with algorithm
 
Chapter 6 algorithms and flow charts
Chapter 6  algorithms and flow chartsChapter 6  algorithms and flow charts
Chapter 6 algorithms and flow charts
 
Basics of c++ Programming Language
Basics of c++ Programming LanguageBasics of c++ Programming Language
Basics of c++ Programming Language
 
Data Structures and Algorithm - Module 1.pptx
Data Structures and Algorithm - Module 1.pptxData Structures and Algorithm - Module 1.pptx
Data Structures and Algorithm - Module 1.pptx
 
ppt of flowchart
ppt of flowchartppt of flowchart
ppt of flowchart
 
Flowchart and algorithem
Flowchart and algorithemFlowchart and algorithem
Flowchart and algorithem
 
Introduction to C programming
Introduction to C programmingIntroduction to C programming
Introduction to C programming
 
algo
algoalgo
algo
 
Basic structure of C++ program
Basic structure of C++ programBasic structure of C++ program
Basic structure of C++ program
 
Unit 1. Problem Solving with Computer
Unit 1. Problem Solving with Computer   Unit 1. Problem Solving with Computer
Unit 1. Problem Solving with Computer
 
What is programming what are its benefits
What is programming  what are its benefits What is programming  what are its benefits
What is programming what are its benefits
 
Programming flowcharts for C Language
Programming flowcharts for C LanguageProgramming flowcharts for C Language
Programming flowcharts for C Language
 
DESIGN AND ANALYSIS OF ALGORITHMS
DESIGN AND ANALYSIS OF ALGORITHMSDESIGN AND ANALYSIS OF ALGORITHMS
DESIGN AND ANALYSIS OF ALGORITHMS
 

Destacado

C Prog. - Introduction to Hardware, Software, Algorithm & Flowchart
C Prog. - Introduction to Hardware, Software, Algorithm & FlowchartC Prog. - Introduction to Hardware, Software, Algorithm & Flowchart
C Prog. - Introduction to Hardware, Software, Algorithm & Flowchartvinay arora
 
Algorithm and flowchart2010
Algorithm and flowchart2010Algorithm and flowchart2010
Algorithm and flowchart2010Jordan Delacruz
 
Algorithm and flowchart
Algorithm and flowchartAlgorithm and flowchart
Algorithm and flowchartIamPe Khamkhum
 
Best Techniques To Design Programs - Program Designing Techniques
Best Techniques To Design Programs - Program Designing TechniquesBest Techniques To Design Programs - Program Designing Techniques
Best Techniques To Design Programs - Program Designing TechniquesTech
 
Microcontroller lec 3
Microcontroller  lec 3Microcontroller  lec 3
Microcontroller lec 3Ibrahim Reda
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programmingHüseyin Ergin
 
Makalah Diagram Alur ( FlowChart )
Makalah Diagram Alur ( FlowChart )Makalah Diagram Alur ( FlowChart )
Makalah Diagram Alur ( FlowChart )Muhammad Iqbal
 
Compilation and Execution
Compilation and ExecutionCompilation and Execution
Compilation and ExecutionChong-Kuan Chen
 
Flowchart slides powerpoint
Flowchart slides powerpointFlowchart slides powerpoint
Flowchart slides powerpointhilmius akbar
 
3 buku pedoman pkl 2016
3 buku pedoman pkl 20163 buku pedoman pkl 2016
3 buku pedoman pkl 2016Pandu Wiza
 
C Programming : Arrays
C Programming : ArraysC Programming : Arrays
C Programming : ArraysGagan Deep
 

Destacado (20)

3 algorithm-and-flowchart
3 algorithm-and-flowchart3 algorithm-and-flowchart
3 algorithm-and-flowchart
 
Flowcharts
FlowchartsFlowcharts
Flowcharts
 
C Prog. - Introduction to Hardware, Software, Algorithm & Flowchart
C Prog. - Introduction to Hardware, Software, Algorithm & FlowchartC Prog. - Introduction to Hardware, Software, Algorithm & Flowchart
C Prog. - Introduction to Hardware, Software, Algorithm & Flowchart
 
Flowchart and algorithm
Flowchart and algorithmFlowchart and algorithm
Flowchart and algorithm
 
Algorithm and flowchart2010
Algorithm and flowchart2010Algorithm and flowchart2010
Algorithm and flowchart2010
 
Algorithm and flowchart
Algorithm and flowchartAlgorithm and flowchart
Algorithm and flowchart
 
C lects (3)
C lects (3)C lects (3)
C lects (3)
 
Best Techniques To Design Programs - Program Designing Techniques
Best Techniques To Design Programs - Program Designing TechniquesBest Techniques To Design Programs - Program Designing Techniques
Best Techniques To Design Programs - Program Designing Techniques
 
Microcontroller lec 3
Microcontroller  lec 3Microcontroller  lec 3
Microcontroller lec 3
 
Flowchart - Sistem Komputer
Flowchart - Sistem KomputerFlowchart - Sistem Komputer
Flowchart - Sistem Komputer
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
 
Makalah Diagram Alur ( FlowChart )
Makalah Diagram Alur ( FlowChart )Makalah Diagram Alur ( FlowChart )
Makalah Diagram Alur ( FlowChart )
 
Compilation and Execution
Compilation and ExecutionCompilation and Execution
Compilation and Execution
 
Ebooks Flow Chart
Ebooks Flow ChartEbooks Flow Chart
Ebooks Flow Chart
 
Flowchart slides powerpoint
Flowchart slides powerpointFlowchart slides powerpoint
Flowchart slides powerpoint
 
3.algoritma dasar
3.algoritma dasar3.algoritma dasar
3.algoritma dasar
 
3 buku pedoman pkl 2016
3 buku pedoman pkl 20163 buku pedoman pkl 2016
3 buku pedoman pkl 2016
 
C Programming : Arrays
C Programming : ArraysC Programming : Arrays
C Programming : Arrays
 
Lecture 4
Lecture 4Lecture 4
Lecture 4
 
Function in C program
Function in C programFunction in C program
Function in C program
 

Similar a Algorithm and flowchart

ALGORITHM PPT GUIDE.pdf
ALGORITHM PPT GUIDE.pdfALGORITHM PPT GUIDE.pdf
ALGORITHM PPT GUIDE.pdfmeychu1
 
Lecture1-Algorithms-and-Flowcharts-ppt.ppt
Lecture1-Algorithms-and-Flowcharts-ppt.pptLecture1-Algorithms-and-Flowcharts-ppt.ppt
Lecture1-Algorithms-and-Flowcharts-ppt.pptReshuReshma8
 
Basic Slides on Algorithms and Flowcharts
Basic Slides on Algorithms and FlowchartsBasic Slides on Algorithms and Flowcharts
Basic Slides on Algorithms and Flowchartsmoazwinner
 
Ch1 principles of software development
Ch1 principles of software developmentCh1 principles of software development
Ch1 principles of software developmentHattori Sidek
 
algorithms and flow chart overview.pdf
algorithms and flow chart overview.pdfalgorithms and flow chart overview.pdf
algorithms and flow chart overview.pdfAmanPratik11
 
Lecture_01-Problem_Solving[1]||ProgrammingFundamental.ppt
Lecture_01-Problem_Solving[1]||ProgrammingFundamental.pptLecture_01-Problem_Solving[1]||ProgrammingFundamental.ppt
Lecture_01-Problem_Solving[1]||ProgrammingFundamental.pptcosc242101003
 
01 Introduction to analysis of Algorithms.pptx
01 Introduction to analysis of Algorithms.pptx01 Introduction to analysis of Algorithms.pptx
01 Introduction to analysis of Algorithms.pptxssuser586772
 
Algorithm and flowchart.pptx
Algorithm and flowchart.pptxAlgorithm and flowchart.pptx
Algorithm and flowchart.pptxMaheShiva
 
Introduction to computer science
Introduction to computer scienceIntroduction to computer science
Introduction to computer scienceumardanjumamaiwada
 
AlgorithmAndFlowChart.pdf
AlgorithmAndFlowChart.pdfAlgorithmAndFlowChart.pdf
AlgorithmAndFlowChart.pdfSusieMaestre1
 
Algorithms notes 2 tutorials duniya
Algorithms notes 2   tutorials duniyaAlgorithms notes 2   tutorials duniya
Algorithms notes 2 tutorials duniyaTutorialsDuniya.com
 
Algorithms and flowcharts
Algorithms and flowchartsAlgorithms and flowcharts
Algorithms and flowchartskhair20
 
Algorithm for computational problematic sit
Algorithm for computational problematic sitAlgorithm for computational problematic sit
Algorithm for computational problematic sitSaurabh846965
 
c_algo_flowchart.pdf
c_algo_flowchart.pdfc_algo_flowchart.pdf
c_algo_flowchart.pdfsimmis5
 
Unit 1 python (2021 r)
Unit 1 python (2021 r)Unit 1 python (2021 r)
Unit 1 python (2021 r)praveena p
 

Similar a Algorithm and flowchart (20)

ALGORITHM PPT GUIDE.pdf
ALGORITHM PPT GUIDE.pdfALGORITHM PPT GUIDE.pdf
ALGORITHM PPT GUIDE.pdf
 
UNIT 1.pptx
UNIT 1.pptxUNIT 1.pptx
UNIT 1.pptx
 
Lecture1-Algorithms-and-Flowcharts-ppt.ppt
Lecture1-Algorithms-and-Flowcharts-ppt.pptLecture1-Algorithms-and-Flowcharts-ppt.ppt
Lecture1-Algorithms-and-Flowcharts-ppt.ppt
 
Basic Slides on Algorithms and Flowcharts
Basic Slides on Algorithms and FlowchartsBasic Slides on Algorithms and Flowcharts
Basic Slides on Algorithms and Flowcharts
 
Ch1 principles of software development
Ch1 principles of software developmentCh1 principles of software development
Ch1 principles of software development
 
algorithms and flow chart overview.pdf
algorithms and flow chart overview.pdfalgorithms and flow chart overview.pdf
algorithms and flow chart overview.pdf
 
Lecture_01-Problem_Solving[1]||ProgrammingFundamental.ppt
Lecture_01-Problem_Solving[1]||ProgrammingFundamental.pptLecture_01-Problem_Solving[1]||ProgrammingFundamental.ppt
Lecture_01-Problem_Solving[1]||ProgrammingFundamental.ppt
 
01 Introduction to analysis of Algorithms.pptx
01 Introduction to analysis of Algorithms.pptx01 Introduction to analysis of Algorithms.pptx
01 Introduction to analysis of Algorithms.pptx
 
Algorithms and Flowchart.ppt
Algorithms and Flowchart.pptAlgorithms and Flowchart.ppt
Algorithms and Flowchart.ppt
 
Algorithm and flowchart.pptx
Algorithm and flowchart.pptxAlgorithm and flowchart.pptx
Algorithm and flowchart.pptx
 
lecture 5
 lecture 5 lecture 5
lecture 5
 
Introduction to computer science
Introduction to computer scienceIntroduction to computer science
Introduction to computer science
 
AlgorithmAndFlowChart.pdf
AlgorithmAndFlowChart.pdfAlgorithmAndFlowChart.pdf
AlgorithmAndFlowChart.pdf
 
Chap6
Chap6Chap6
Chap6
 
Algorithms notes 2 tutorials duniya
Algorithms notes 2   tutorials duniyaAlgorithms notes 2   tutorials duniya
Algorithms notes 2 tutorials duniya
 
Algorithms and flowcharts
Algorithms and flowchartsAlgorithms and flowcharts
Algorithms and flowcharts
 
Algorithm for computational problematic sit
Algorithm for computational problematic sitAlgorithm for computational problematic sit
Algorithm for computational problematic sit
 
c_algo_flowchart.pdf
c_algo_flowchart.pdfc_algo_flowchart.pdf
c_algo_flowchart.pdf
 
Module 1 python.pptx
Module 1 python.pptxModule 1 python.pptx
Module 1 python.pptx
 
Unit 1 python (2021 r)
Unit 1 python (2021 r)Unit 1 python (2021 r)
Unit 1 python (2021 r)
 

Último

Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptNANDHAKUMARA10
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXssuser89054b
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordAsst.prof M.Gokilavani
 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringmulugeta48
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...Call Girls in Nagpur High Profile
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptDineshKumar4165
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VDineshKumar4165
 
Unit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdfUnit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdfRagavanV2
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Arindam Chakraborty, Ph.D., P.E. (CA, TX)
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfKamal Acharya
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startQuintin Balsdon
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdfKamal Acharya
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performancesivaprakash250
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfJiananWang21
 
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank  Design by Working Stress - IS Method.pdfIntze Overhead Water Tank  Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank Design by Working Stress - IS Method.pdfSuman Jyoti
 
Intro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdfIntro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdfrs7054576148
 
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...tanu pandey
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfRagavanV2
 

Último (20)

Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.ppt
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineering
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
Unit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdfUnit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdf
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the start
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank  Design by Working Stress - IS Method.pdfIntze Overhead Water Tank  Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
 
NFPA 5000 2024 standard .
NFPA 5000 2024 standard                                  .NFPA 5000 2024 standard                                  .
NFPA 5000 2024 standard .
 
Intro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdfIntro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdf
 
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdf
 

Algorithm and flowchart

  • 1. 1 Subject : C.P.U Topic: Algorithms and Flowchart
  • 2. 2 Name of Students in Group:
  • 4. Program design  Program Design Process has 2 phases:  Problem Solving Phase  Creates an algorithm that solves the problem  Implementation (Coding) Phase  Translates the algorithm into a programming language 4 Algorithm Problem Program
  • 5. Algorithms  An algorithm is a finite set of steps defining the solution of a particular problem.  Need not to belong one particular language  Sequence of English statements can also be algorithm  It is not a computer program  An algorithm can be expressed in English like language called pseudo code, in a programming language or in the form of flowchart. 5
  • 6. Algorithm Vs Program  What is the difference between an algorithm and a program?  a program is an implementation of an algorithm to be run on a specific computer and operating system.  an algorithm is more abstract – it does not deal with machine specific details – think of it as a method to solve a problem. • What is good algorithm? Efficient algorithms are good, we generally measure efficiency of an algorithm on the basis of: 1. Time: algorithm should take minimum time to execute. 2. Space: algorithm should use less memory. 6
  • 7. Algorithm Specification Every algorithm must satisfy the following criteria:  Input. Zero or more quantities are externally supplied.  Output. At least one quantity is produced.  Definiteness. Each instruction must be clear and unambiguous(Unique meaning).  Finiteness. An algorithm terminates in a finite number of steps.  Effectiveness. Every instruction must be basic enough to be carried out than, means not so complex. 7
  • 9. 9 Finding the largest integer among five integers
  • 10. 10 Defining actions in Find Largest algorithm
  • 11. 11
  • 12. 12 Example 1 Write an algorithm that finds the average of two numbers Solution: Average Of Two Input: Two numbers 1. Add the two numbers 2. Divide the result by 2 3. Return the result by step 2 2 End
  • 13. Group 13 Example 2 Write an algorithm to change a numeric grade to a pass/fail grade. Solution: Pass/Fail Grade Input: One number 1. if (the number is greater than or equal to 40) then 1.1 Set the grade to “pass” else 1.2 Set the grade to “fail” End if 2. Return the grade End
  • 14. 14 Example 3 Write an algorithm for grading System by following method. Marks range Grade >=80 A >=70 & <80 B >=60 & <70 C >=50 & <60 D <50 F
  • 15. 15 Algorithm For Grade Input: One number 1. if (the number is between 80 and 100, inclusive) then 1.1 Set the grade to “A” End if 2. if (the number is between 70 and 79, inclusive) then 2.1 Set the grade to “B” End if Algorithm for Grading Continues on the next slide Solution
  • 16. 16 3. if (the number is between 60 and 69, inclusive) then 3.1 Set the grade to “C” End if 4. if (the number is between 50 and 59, inclusive) then 4.1 Set the grade to “D” End if 5. If (the number is less than 50) then 5.1 Set the grade to “F” End if 6. Return the grade End
  • 17. Advantages Of Algorithm  It provides the core solution to a given problem. This solution can be implemented on a computer system using any programming language of user’s choice.  It facilitates program development by acting as a design document or a blueprint of a given problem solution.  It ensures easy comprehension of a problem solution as compared to an equivalent computer program.  It eases identification and removal of logical errors in a program.  It facilitates algorithm analysis to find out the most efficient solution to a given problem. 17
  • 18. Disadvantages Of Algorithm  In large algorithms, the flow of program control becomes difficult to track.  Algorithms lack visual representation of programming constructs like flowcharts; thus, understanding the logic becomes relatively difficult. 18
  • 19. Flowchart A graphical representation of an algorithm, often used in the design phase of programming to work out the logical flow of a program.  Visual way to represent the information flow  Make our logic more clear  Help during writing of program  Make testing and debugging easy 19
  • 20. 20
  • 21. Flowchart or program constructs  Sequence: The order of execution, this typically refers to the order in which the code will execute. Normally code executes line by line, so line 1 then 2 then 3 and so on.  Selection: Selection, like branching, is a method of controlling the execution sequence, you can create large control blocks, using if statements testing a condition, or switch statements evaluating a variable etc to control and change the execution of the program depending on this environment and changing variables.  Iteration (Repetition): Iteration is typically used to refer to collections and arrays of variables and data. Repeating set of instruction. Counting from 1 to 10, you are iterating over the first 10 numbers. for, while, do-while loops will be implemented for iteration. 21
  • 25. Example-1 Write an algorithm and draw a flowchart that will read the two sides of a rectangle and calculate its area. Algorithm  Step 1: Start  Step 2: Take Width and Length as input  Step 3: Calculate Area by Width* Length  Step 4: Print Area.  Step 5: End 25
  • 26. Example-1  Step 1: Start  Step 2: Input W,L  Step 3: A  L x W  Step 4: Print A  Step 5: End 26 START Input W, L A L x W STOP Print A
  • 27. Example-2  Write an Pseudo code and draw a flowchart that will take marks of four subjects and calculate the average. Then if average marks are greater than 50 then print PASS otherwise print FAIL. 27
  • 28. Example-2 28 Step 1: Start Step 2: Input M1,M2,M3,M4 Step 3: AVG  (M1+M2+M3+M4)/4 Step 4: if (AVG <50) then Print “FAIL” else Print “PASS” endif Step 5: End START Input M1,M2,M3,M4 AVG(M1+M2+M3+M4)/4 IS AVG<50 STOP YN Print “PASS” Print “FAIL”
  • 29. Example-3  Write an algorithm and draw a flowchart to convert the length in feet to centimeter. 29
  • 30. Example-3 Algorithm  Step 1: Start  Step 2: Input Lft  Step 3: Lcm  Lft x 30  Step 4: Print Lcm  Step 5: End 30 START Input Lft Lcm Lft x 30 Print Lcm STOP Flowchart
  • 31. Example-4  Write an algorithm and draw a flowchart that will calculate the roots of a quadratic equation  Hint: d = sqrt ( ), and the roots are: x1 = (–b + d)/2a and x2 = (–b – d)/2a 2 0ax bx c   2 4b ac 31
  • 32. Example-4 Algorithm:  Step 1: Start  Step 2: Input a, b, c  Step 3: d  sqrt ( )  Step 4: x1  (–b + d) / (2 x a)  Step 5: x2  (–b – d) / (2 x a)  Step 6: Print x1, x2  Step 7: End 4b b a c    32 START Input a, b, c d  sqrt(b x b – 4 x a x c) Print x1 ,x2 STOP x1 (–b + d) / (2 x a) X2 (–b – d) / (2 x a)
  • 33. Flow Chart`s Limitation  For very large program, flow chart goes for many pages  Costly to draw flow charts for large program  Difficult to modify 33

Notas del editor

  1. 5