Draw a flowchart from pseudocode

Resources | Subject Notes | Computer Science

Algorithm Design - Flowchart from Pseudo-code

Algorithm Design - Flowchart from Pseudo-code

Objective

To learn how to draw a flowchart based on a given set of pseudo-code instructions.

Understanding Flowcharts

A flowchart is a diagram that illustrates the steps involved in solving a problem. It uses standard symbols to represent different types of operations and the flow of control.

Common Flowchart Symbols

Symbol Description
Start/End Oval - Indicates the beginning and end of the algorithm.
Process Rectangle - Represents a step or operation.
Decision Diamond - Represents a point where a decision is made.
Input/Output Parallelogram - Represents input or output operations.
Connector Circle - Used to connect different parts of the flowchart.
Predefined Process Rectangle with double lines - Represents a sub-routine or predefined process.

Example Pseudo-code

Consider the following pseudo-code algorithm to calculate the area of a rectangle:

    START
    INPUT length, width
    IF length > 0 AND width > 0 THEN
        area = length * width
        OUTPUT area
    ELSE
        OUTPUT "Invalid input: Length and width must be positive."
    ENDIF
    END
    

Flowchart Representation

Here's the flowchart representation of the above pseudo-code:

Suggested diagram: A flowchart showing start, input for length and width, a decision diamond checking if both are positive, a process rectangle for calculating area, an output parallelogram, and an end oval.

  1. Start (Oval)
  2. Input length, width (Parallelogram)
  3. Decision: length > 0 AND width > 0 (Diamond)
  4. If Yes:

  5. area = length * width (Process)
  6. Output area (Parallelogram)
  7. If No:

  8. Output "Invalid input..." (Parallelogram)
  9. End (Oval)

Explanation

The flowchart visually represents the flow of control in the algorithm. It shows the input steps, the decision point, the calculation process, and the output steps. The connectors indicate the flow of execution.