SlideShare a Scribd company logo
1 of 20
ALGORITHM AND FLOWCHART
.
What is an Algorithm?
The word Algorithm means ” A set of finite rules
or instructions to be followed in calculations or
other problem-solving operations ” Or ” A
procedure for solving a mathematical problem
in a finite number of steps that frequently
involves recursive operations”.
ALGORITHM FOR ADDING TWO NUMBERS
CHARACTERISTICS OF AN ALGORITHM
• Clear and Unambiguous: The algorithm should
be clear and unambiguous. Each of its steps
should be clear in all aspects and must lead to
only one meaning.
• Well-Defined Inputs: If an algorithm says to
take inputs, it should be well-defined inputs. It
may or may not take input.
• Well-Defined Outputs: The algorithm must
clearly define what output will be yielded and it
should be well-defined as well. It should take at
least 1 output.
CHARACTERISTICS OF AN ALGORITHM
Finite-ness: The algorithm must be finite, i.e. it
should terminate after a finite time.
• Feasible: The algorithm must be simple, generic,
and practical, such that it can be executed with
the available resources. It must not contain some
future technology or anything.
• Language Independent: The Algorithm designed
must be language-independent, i.e. it must be
just plain instructions that can be implemented in
any language, and yet the output will be the
same, as expected.
Properties of Algorithm:
• It should terminate after a finite time.
• It should produce at least one output.
• It should take zero or more input.
• It should be deterministic means giving the
same output for the same input case.
• Every step in the algorithm must be effective
i.e. every step should do some work.
How to Design an Algorithm?
• In order to write an algorithm, the following things are
needed as a pre-requisite:
• The problem that is to be solved by this algorithm i.e.
clear problem definition.
• The constraints of the problem must be considered
while solving the problem.
• The input to be taken to solve the problem.
• The output to be expected when the problem is
solved.
• The solution to this problem, is within the given
constraints.
Then the algorithm is written with the help of the above parameters such
that it solves the problem.
Example: Consider the example to add three numbers and print the sum.
•
• Step 1: Fulfilling the pre-requisites
As discussed above, in order to write an algorithm, its pre-requisites must
be fulfilled.
– The problem that is to be solved by this algorithm: Add 3 numbers and print
their sum.
– The constraints of the problem that must be considered while solving the
problem: The numbers must contain only digits and no other characters.
– The input to be taken to solve the problem: The three numbers to be added.
– The output to be expected when the problem is solved: The sum of the three
numbers taken as the input i.e. a single integer value.
– The solution to this problem, in the given constraints: The solution consists of
adding the 3 numbers. It can be done with the help of ‘+’ operator, or bit-wise,
or any other method.
•
Step 2: Designing the algorithm
Now let’s design the algorithm with the help
of the above pre-requisites:
• Algorithm to add 3 numbers and print their sum:
– START
– Declare 3 integer variables num1, num2 and num3.
– Take the three numbers, to be added, as inputs in variables
num1, num2, and num3 respectively.
– Declare an integer variable sum to store the resultant sum
of the 3 numbers.
– Add the 3 numbers and store the result in the variable
sum.
– Print the value of the variable sum
– END
Step 3: Testing the algorithm by implementing
it.
In order to test the algorithm, let’s implement
it in C language.
C program to add three numbers
• // C program to add three numbers
• // with the help of above designed algorithm
•
• #include <stdio.h>
•
• int main()
• {
•
• // Variables to take the input of the 3 numbers
• int num1, num2, num3;
•
• // Variable to store the resultant sum
• int sum;
•
•
• // Take the 3 numbers as input
• printf("Enter the 1st number: ");
• scanf("%d", &num1);
• printf("%dn", num1);
•
• printf("Enter the 2nd number: ");
• scanf("%d", &num2);
• printf("%dn", num2);
•
• printf("Enter the 3rd number: ");
• scanf("%d", &num3);
• printf("%dn", num3);
•
• // Calculate the sum using + operator
• // and store it in variable sum
• sum = num1 + num2 + num3;
•
• // Print the sum
• printf("nSum of the 3 numbers is: %d", sum);
•
• return 0;
• }
Time Complexity
The time complexity of an algorithm
refers to the amount of time that is
required by the algorithm to execute and
get the result.
FLOWCHART
A flowchart is a diagram that shows an
overview of a program . Flowcharts normally
use standard symbols to represent the
different types of instructions . These symbols
are used to construct the flowchart and show
the step-by-step solution to the problem.
Flowcharts are sometimes known as flow
diagrams.
THANK YOU

More Related Content

Similar to ALGO VS FLOW.pptx

Basic syntax : Algorithm,Flow chart
Basic syntax : Algorithm,Flow chartBasic syntax : Algorithm,Flow chart
Basic syntax : Algorithm,Flow chartPrasanna R Kovath
 
Chapter1.1 Introduction.ppt
Chapter1.1 Introduction.pptChapter1.1 Introduction.ppt
Chapter1.1 Introduction.pptTekle12
 
Chapter1.1 Introduction to design and analysis of algorithm.ppt
Chapter1.1 Introduction to design and analysis of algorithm.pptChapter1.1 Introduction to design and analysis of algorithm.ppt
Chapter1.1 Introduction to design and analysis of algorithm.pptTekle12
 
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
 
Introduction to data structure
Introduction to data structureIntroduction to data structure
Introduction to data structureA. S. M. Shafi
 
Logic Development and Algorithm.
Logic Development and Algorithm.Logic Development and Algorithm.
Logic Development and Algorithm.NandiniSidana
 
DA lecture 3.pptx
DA lecture 3.pptxDA lecture 3.pptx
DA lecture 3.pptxSayanSen36
 
Concept of Algorithm.pptx
Concept of Algorithm.pptxConcept of Algorithm.pptx
Concept of Algorithm.pptxElProfesor14
 
C LANGUAGE-FLOWCHARTS,PSEUDOCODE,ALGORITHMS APPROCHES
C LANGUAGE-FLOWCHARTS,PSEUDOCODE,ALGORITHMS APPROCHESC LANGUAGE-FLOWCHARTS,PSEUDOCODE,ALGORITHMS APPROCHES
C LANGUAGE-FLOWCHARTS,PSEUDOCODE,ALGORITHMS APPROCHESHarshJha34
 
2.3 Apply the different types of algorithm to solve problem
2.3 Apply the different types of algorithm to solve problem2.3 Apply the different types of algorithm to solve problem
2.3 Apply the different types of algorithm to solve problemFrankie Jones
 
Types of Algorithms.ppt
Types of Algorithms.pptTypes of Algorithms.ppt
Types of Algorithms.pptALIZAIB KHAN
 
Unit 1, ADA.pptx
Unit 1, ADA.pptxUnit 1, ADA.pptx
Unit 1, ADA.pptxjinkhatima
 
Analysis and Design of Algorithms
Analysis and Design of AlgorithmsAnalysis and Design of Algorithms
Analysis and Design of AlgorithmsBulbul Agrawal
 
2-Algorithms and Complexit data structurey.pdf
2-Algorithms and Complexit data structurey.pdf2-Algorithms and Complexit data structurey.pdf
2-Algorithms and Complexit data structurey.pdfishan743441
 
Algorithm analysis and design
Algorithm analysis and designAlgorithm analysis and design
Algorithm analysis and designMegha V
 

Similar to ALGO VS FLOW.pptx (20)

Basic syntax : Algorithm,Flow chart
Basic syntax : Algorithm,Flow chartBasic syntax : Algorithm,Flow chart
Basic syntax : Algorithm,Flow chart
 
Chapter1.1 Introduction.ppt
Chapter1.1 Introduction.pptChapter1.1 Introduction.ppt
Chapter1.1 Introduction.ppt
 
Chapter1.1 Introduction to design and analysis of algorithm.ppt
Chapter1.1 Introduction to design and analysis of algorithm.pptChapter1.1 Introduction to design and analysis of algorithm.ppt
Chapter1.1 Introduction to design and analysis of algorithm.ppt
 
Algorithms.pdf
Algorithms.pdfAlgorithms.pdf
Algorithms.pdf
 
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
 
Introduction to data structure
Introduction to data structureIntroduction to data structure
Introduction to data structure
 
Introduction to algorithms
Introduction to algorithmsIntroduction to algorithms
Introduction to algorithms
 
Logic Development and Algorithm.
Logic Development and Algorithm.Logic Development and Algorithm.
Logic Development and Algorithm.
 
DA lecture 3.pptx
DA lecture 3.pptxDA lecture 3.pptx
DA lecture 3.pptx
 
Lecture 7.pptx
Lecture 7.pptxLecture 7.pptx
Lecture 7.pptx
 
Concept of Algorithm.pptx
Concept of Algorithm.pptxConcept of Algorithm.pptx
Concept of Algorithm.pptx
 
C LANGUAGE-FLOWCHARTS,PSEUDOCODE,ALGORITHMS APPROCHES
C LANGUAGE-FLOWCHARTS,PSEUDOCODE,ALGORITHMS APPROCHESC LANGUAGE-FLOWCHARTS,PSEUDOCODE,ALGORITHMS APPROCHES
C LANGUAGE-FLOWCHARTS,PSEUDOCODE,ALGORITHMS APPROCHES
 
2.3 Apply the different types of algorithm to solve problem
2.3 Apply the different types of algorithm to solve problem2.3 Apply the different types of algorithm to solve problem
2.3 Apply the different types of algorithm to solve problem
 
UNIT 1.pptx
UNIT 1.pptxUNIT 1.pptx
UNIT 1.pptx
 
Types of Algorithms.ppt
Types of Algorithms.pptTypes of Algorithms.ppt
Types of Algorithms.ppt
 
Unit 1, ADA.pptx
Unit 1, ADA.pptxUnit 1, ADA.pptx
Unit 1, ADA.pptx
 
Analysis and Design of Algorithms
Analysis and Design of AlgorithmsAnalysis and Design of Algorithms
Analysis and Design of Algorithms
 
2-Algorithms and Complexit data structurey.pdf
2-Algorithms and Complexit data structurey.pdf2-Algorithms and Complexit data structurey.pdf
2-Algorithms and Complexit data structurey.pdf
 
Algorithm analysis and design
Algorithm analysis and designAlgorithm analysis and design
Algorithm analysis and design
 
Algorithm.pdf
Algorithm.pdfAlgorithm.pdf
Algorithm.pdf
 

Recently uploaded

1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxnegromaestrong
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxVishalSingh1417
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docxPoojaSen20
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfAyushMahapatra5
 

Recently uploaded (20)

1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 

ALGO VS FLOW.pptx

  • 2. What is an Algorithm? The word Algorithm means ” A set of finite rules or instructions to be followed in calculations or other problem-solving operations ” Or ” A procedure for solving a mathematical problem in a finite number of steps that frequently involves recursive operations”.
  • 3. ALGORITHM FOR ADDING TWO NUMBERS
  • 4.
  • 5.
  • 6. CHARACTERISTICS OF AN ALGORITHM • Clear and Unambiguous: The algorithm should be clear and unambiguous. Each of its steps should be clear in all aspects and must lead to only one meaning. • Well-Defined Inputs: If an algorithm says to take inputs, it should be well-defined inputs. It may or may not take input. • Well-Defined Outputs: The algorithm must clearly define what output will be yielded and it should be well-defined as well. It should take at least 1 output.
  • 7. CHARACTERISTICS OF AN ALGORITHM Finite-ness: The algorithm must be finite, i.e. it should terminate after a finite time. • Feasible: The algorithm must be simple, generic, and practical, such that it can be executed with the available resources. It must not contain some future technology or anything. • Language Independent: The Algorithm designed must be language-independent, i.e. it must be just plain instructions that can be implemented in any language, and yet the output will be the same, as expected.
  • 8. Properties of Algorithm: • It should terminate after a finite time. • It should produce at least one output. • It should take zero or more input. • It should be deterministic means giving the same output for the same input case. • Every step in the algorithm must be effective i.e. every step should do some work.
  • 9. How to Design an Algorithm? • In order to write an algorithm, the following things are needed as a pre-requisite: • The problem that is to be solved by this algorithm i.e. clear problem definition. • The constraints of the problem must be considered while solving the problem. • The input to be taken to solve the problem. • The output to be expected when the problem is solved. • The solution to this problem, is within the given constraints.
  • 10. Then the algorithm is written with the help of the above parameters such that it solves the problem. Example: Consider the example to add three numbers and print the sum. • • Step 1: Fulfilling the pre-requisites As discussed above, in order to write an algorithm, its pre-requisites must be fulfilled. – The problem that is to be solved by this algorithm: Add 3 numbers and print their sum. – The constraints of the problem that must be considered while solving the problem: The numbers must contain only digits and no other characters. – The input to be taken to solve the problem: The three numbers to be added. – The output to be expected when the problem is solved: The sum of the three numbers taken as the input i.e. a single integer value. – The solution to this problem, in the given constraints: The solution consists of adding the 3 numbers. It can be done with the help of ‘+’ operator, or bit-wise, or any other method. •
  • 11. Step 2: Designing the algorithm Now let’s design the algorithm with the help of the above pre-requisites:
  • 12. • Algorithm to add 3 numbers and print their sum: – START – Declare 3 integer variables num1, num2 and num3. – Take the three numbers, to be added, as inputs in variables num1, num2, and num3 respectively. – Declare an integer variable sum to store the resultant sum of the 3 numbers. – Add the 3 numbers and store the result in the variable sum. – Print the value of the variable sum – END
  • 13. Step 3: Testing the algorithm by implementing it. In order to test the algorithm, let’s implement it in C language.
  • 14. C program to add three numbers • // C program to add three numbers • // with the help of above designed algorithm • • #include <stdio.h> • • int main() • { • • // Variables to take the input of the 3 numbers • int num1, num2, num3; • • // Variable to store the resultant sum • int sum; • •
  • 15. • // Take the 3 numbers as input • printf("Enter the 1st number: "); • scanf("%d", &num1); • printf("%dn", num1); • • printf("Enter the 2nd number: "); • scanf("%d", &num2); • printf("%dn", num2); • • printf("Enter the 3rd number: "); • scanf("%d", &num3); • printf("%dn", num3); • • // Calculate the sum using + operator • // and store it in variable sum • sum = num1 + num2 + num3; • • // Print the sum • printf("nSum of the 3 numbers is: %d", sum); • • return 0; • }
  • 16. Time Complexity The time complexity of an algorithm refers to the amount of time that is required by the algorithm to execute and get the result.
  • 17. FLOWCHART A flowchart is a diagram that shows an overview of a program . Flowcharts normally use standard symbols to represent the different types of instructions . These symbols are used to construct the flowchart and show the step-by-step solution to the problem. Flowcharts are sometimes known as flow diagrams.
  • 18.
  • 19.