Analysis of Algorithm and Flow Chart

Algorithm

An algorithm is a complete, detailed, and precise step by step method for solving a problem independently of the software and hardware of the computer.

Efficiency of an algorithm (termination and correctness):

Efficiency of an algorithm means how fast it can produce the correct result for the given problem. The efficiency of an algorithm depends upon its time complexity and space complexity.

  • Space complexity: space complexity of an algorithm refers to the amount of memory required by algorithm for its execution and generation of the final output.
  • Time complexity: time complexity of an algorithm refers to the amount of computer time required by an algorithm for its execution. This time include both compile time and run time.

Analysis of an algorithm:

The Analysis of an algorithm determines the amount of resources such as time and space required by it, for its execution. Algorithm analysis provides theoretical estimates for its complexity and this complexity can be denoted in asymptotic notations. The basic notation used to represent the complexity of an algorithm is:

Characteristic of an algorithm: there are five important characteristic of an algorithm

  • Input– it may accept zero or more input
  • Output- it should produce at least one output.
  • Definiteness- each instruction must be clear, well defined and precise. there should not be any ambiguity.
  • Finiteness –it should be a sequence of finite instructions.
  • Effectiveness- operation must be simple and carried out in a finite time at one or more levels of complexity.

Question: write an algorithm for finding greatest among three numbers.

Algorithm:

Step 1: START

Step 2: Read three number x, y, z.

Step 3:  If x>y

               a) If x>z then x is greatest number
b) Else z is greatest number

Step 4:  else

                a) If y>z then y is greatest number
 b) Else z is greatest number

Step 5:  Stop

Flowchart

When step by step solution of a given problem is illustrated in the form of graphical chart that chart is called flowchart.

Symbols of flow chart:

Terminal box– this symbol is used to represent starting and stopping of a program.

rrrr

Processing box- All arithmetic process such as addition, multiplication, division, subtraction are depict in processing box. It is denoted by rectangle.

rrrr

Read / write box- A parallelogram is used to depict the reading /writing process.

rrrr

Decision box- A diamond symbol is used for depicting comparison of two values or condition checking or decision making in flowchart.

rrrr

Flow line- a flow line is a simple line with an arrow at its front end. The head of arrow depicts the direction of flow.

rrrr

Connecter – there are two type of connecter are used in the flowchart.

  • Same page connecter
  • Off-page connecter.

rrrr

Question: Give a flow chart for finding the given number is odd or even.

Flowchart:

rrrr

 

Share Button

Feedback is important to us.

One thought on “Analysis of Algorithm and Flow Chart

Leave a Reply

Your email address will not be published. Required fields are marked *

error: Content is protected !!