Algorithms and Flow charts C. P. Divate
Contents  Today's Topic: Problem Solving Techniques  We will learn 1. Problem Statement. 2. Algorithm  Types, Example 3. Flowchart  Symbols, Examples.
Problem Solving Techniques
Problem Statement: Problem Statement:  The problem statement is an integral part of creating any Question.  A good problem statement should comprise,  a clear and detailed problem description,  supporting data,  at least one sample test case with an explanation, and  constraints of the problem.
Problem Statement: How to Specify the Problem Statement:  Collect and analyze information and data.  Talk with people familiar with the problem.  If at all possible, view the problem first hand.  Confirm all findings.
Algorithm:  Algorithm in C Language. Algorithm is a step-by-step procedure, which defines a set of instructions to be executed in a certain order to get the desired output.  Algorithms are generally created independent of underlying languages, The algorithm is part of the blueprint or plan for the computer program, an algorithm is: “An effective procedure for solving a class of problems in a finite number of steps.” Every algorithm should have the following 5 characteristic feature: 1. Start 2. Input 3. Processing 4. Output 5. Termination
Flowchart: What is a Flowchart?  The flowchart is a means of graphically presenting the flow of control of program.  It is a diagrametic representation of how a process works, showing, at a minimum, the sequence of steps.  Flowcharts are generally drawn in the early stages of program coding.  Flowcharts are usually drawn using some standard symbols.
ADVANTAGES OF USING FLOWCHARTS:  Communication: Flowcharts are better way of communicating the logic of a system  Effective analysis: Problem can be analyzed in more effective way.  Proper documentation: Flowcharts serve as a good program documentation  Efficient Coding: Flowcharts act as a guide or blueprint during the systems analysis and program development phase.  Proper Debugging: Flowchart helps in debugging process.  Efficient Program Maintenance: The maintenance of operating program becomes easy with the help of flowchart.
SIMPLE FLOWCHARTS:
SIMPLE FLOWCHARTS:
SIMPLE FLOWCHARTS:
SIMPLE FLOWCHARTS:
SIMPLE FLOWCHARTS:
SIMPLE FLOWCHARTS:
SIMPLE FLOWCHARTS:
SIMPLE FLOWCHARTS:
Flowcharts with Gant chart The following sample flowcharts are easy to customize. Simply click on a word, shape or rule to edit, change color or adjust an element. Contents • Slide 2: Basic Flowchart Shapes and Definitions • Slide 3: Flowchart Example: Brewing Coffee • Slide 4: Flowchart with Horizontal Swimlanes • Slide 5: Flowchart with Vertical Swimlanes A “Swimlane” indicates the department or system responsible for a specific part of the workflow or process.
Basic Flowchart Shapes and Definitions Start / End The start or end of a workflow. Project / Task Process or action. Split or Merge Upright indicates a process split, inverted indicates a merge of processes. Off Page Connector Connector used to connect one page of a flowchart to another. Connector Used to connect one part of a flowchart to another. Decision Decision point in a process or workflow. Input / Output Data: Inputs to, and outputs from, a process. Document Document or report. Manual Input Prompt for information, manually entered into a system.
Coffee Mug Start Flowchart Example: Brewing Coffee Add Filter Grind Beans Pour Brew Read Instructions Cream Coffee Grinder Task Document Add Coffee Add Water Inputs Inputs Finish Coffee Pot Coffee Mug Sugar Drink Task Manual Input Decision Decision Merge No No Yes Yes
Department Group Three Start Flowchart with Horizontal Swimlanes Input Task Manual Input Merge Document Decision Finish Department Department No Yes
System One Start Process Improvement Process Improved? Input / Output Produce Documents Flowchart with Vertical Swimlanes System Two System Three System Four Completed Review data Change Process No Yes
The flow chart of the if statement:
The flow chart of the if…else statement:
Flow chart of the while loop :
Flow chart of the for loop:
The flow chart of the switch statement:
Flowchart for finding the sum of first five natural numbers ( i.e. 1,2,3,4,5):
Flowchart (Example): Flowchart to find the sum of first 50 natural numbers.
Start Read A, B Is A > B Print A Print B End Yes No Flow Chart to find largest of two numbers:
Flowchart to find the largest of three numbers A,B, and C: NO
LIMITATIONS OF USING FLOWCHARTS:  Complex logic: Sometimes, the program logic is quite complicated. In that case, flowchart becomes complex and clumsy.  Alterations and Modifications: If alterations are required the flowchart may require re-drawing completely.  Reproduction: As the flowchart symbols cannot be typed, reproduction of flowchart becomes a problem.
Flowchart (Exercise): 1. Draw a flowchart to depict all steps that you do reach your college. 2. Draw Flowchart for Linear search.

Basics of Programming Algorithms and Flowchart

  • 1.
    Algorithms and Flowcharts C. P. Divate
  • 2.
    Contents  Today's Topic:Problem Solving Techniques  We will learn 1. Problem Statement. 2. Algorithm  Types, Example 3. Flowchart  Symbols, Examples.
  • 3.
  • 4.
    Problem Statement: Problem Statement: The problem statement is an integral part of creating any Question.  A good problem statement should comprise,  a clear and detailed problem description,  supporting data,  at least one sample test case with an explanation, and  constraints of the problem.
  • 5.
    Problem Statement: How toSpecify the Problem Statement:  Collect and analyze information and data.  Talk with people familiar with the problem.  If at all possible, view the problem first hand.  Confirm all findings.
  • 6.
    Algorithm:  Algorithm inC Language. Algorithm is a step-by-step procedure, which defines a set of instructions to be executed in a certain order to get the desired output.  Algorithms are generally created independent of underlying languages, The algorithm is part of the blueprint or plan for the computer program, an algorithm is: “An effective procedure for solving a class of problems in a finite number of steps.” Every algorithm should have the following 5 characteristic feature: 1. Start 2. Input 3. Processing 4. Output 5. Termination
  • 7.
    Flowchart: What is aFlowchart?  The flowchart is a means of graphically presenting the flow of control of program.  It is a diagrametic representation of how a process works, showing, at a minimum, the sequence of steps.  Flowcharts are generally drawn in the early stages of program coding.  Flowcharts are usually drawn using some standard symbols.
  • 9.
    ADVANTAGES OF USINGFLOWCHARTS:  Communication: Flowcharts are better way of communicating the logic of a system  Effective analysis: Problem can be analyzed in more effective way.  Proper documentation: Flowcharts serve as a good program documentation  Efficient Coding: Flowcharts act as a guide or blueprint during the systems analysis and program development phase.  Proper Debugging: Flowchart helps in debugging process.  Efficient Program Maintenance: The maintenance of operating program becomes easy with the help of flowchart.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
    Flowcharts with Gantchart The following sample flowcharts are easy to customize. Simply click on a word, shape or rule to edit, change color or adjust an element. Contents • Slide 2: Basic Flowchart Shapes and Definitions • Slide 3: Flowchart Example: Brewing Coffee • Slide 4: Flowchart with Horizontal Swimlanes • Slide 5: Flowchart with Vertical Swimlanes A “Swimlane” indicates the department or system responsible for a specific part of the workflow or process.
  • 19.
    Basic Flowchart Shapesand Definitions Start / End The start or end of a workflow. Project / Task Process or action. Split or Merge Upright indicates a process split, inverted indicates a merge of processes. Off Page Connector Connector used to connect one page of a flowchart to another. Connector Used to connect one part of a flowchart to another. Decision Decision point in a process or workflow. Input / Output Data: Inputs to, and outputs from, a process. Document Document or report. Manual Input Prompt for information, manually entered into a system.
  • 20.
    Coffee Mug Start Flowchart Example: BrewingCoffee Add Filter Grind Beans Pour Brew Read Instructions Cream Coffee Grinder Task Document Add Coffee Add Water Inputs Inputs Finish Coffee Pot Coffee Mug Sugar Drink Task Manual Input Decision Decision Merge No No Yes Yes
  • 21.
    Department Group Three Start Flowchart with HorizontalSwimlanes Input Task Manual Input Merge Document Decision Finish Department Department No Yes
  • 22.
    System One Start Process Improvement Process Improved? Input /Output Produce Documents Flowchart with Vertical Swimlanes System Two System Three System Four Completed Review data Change Process No Yes
  • 23.
    The flow chartof the if statement:
  • 24.
    The flow chartof the if…else statement:
  • 25.
    Flow chart ofthe while loop :
  • 26.
    Flow chart ofthe for loop:
  • 27.
    The flow chartof the switch statement:
  • 28.
    Flowchart for findingthe sum of first five natural numbers ( i.e. 1,2,3,4,5):
  • 29.
    Flowchart (Example): Flowchart tofind the sum of first 50 natural numbers.
  • 30.
    Start Read A, B IsA > B Print A Print B End Yes No Flow Chart to find largest of two numbers:
  • 31.
    Flowchart to findthe largest of three numbers A,B, and C: NO
  • 32.
    LIMITATIONS OF USING FLOWCHARTS: Complex logic: Sometimes, the program logic is quite complicated. In that case, flowchart becomes complex and clumsy.  Alterations and Modifications: If alterations are required the flowchart may require re-drawing completely.  Reproduction: As the flowchart symbols cannot be typed, reproduction of flowchart becomes a problem.
  • 33.
    Flowchart (Exercise): 1. Drawa flowchart to depict all steps that you do reach your college. 2. Draw Flowchart for Linear search.