Вы находитесь на странице: 1из 4

Algorithm Development

Algorithm can be represented either using Pseudocodes or Flowcharts, Pseudo code represents the step by step procedure to solve a program using simple English like statements. Flowchart is a graphical representation of a program. The essential characteristics of an Algorithm are: An Algorithm should have a finite number of steps to arrive at a solution. Every step of an algorithm should be unambiguous and perform a single task. An algorithm should have the capability to handle some unexpected situations, which may arise in the solution of a problem.

Steps involved in development of an Algorithm: Clearly understand the inputs, outputs and problem statement. Design the process, which will produce the desired results after taking the input. Refine the process. Test the Algorithm by giving the test data and see if the desired outputs are generated, if not, make appropriate changes and repeat the process.

Advantages: Easy to understand as it is a step-by-step representation of solution. It is independent of any programming language. It is easy to develop and debug.

Pseudocode, which is step by step representation of program logic must be developed using a standard English vocabulary not being biased to any programming language. Example: Pseudocode to check whether a given number is even or odd. Step 1: Start Step 2: Input N Step 3: Calculate R ~ N % 2 Step 4: if ( R = a ) then Output "Even" Else Output "Odd" End if Step 4: Stop

Flowcharts: A flowchart is a pictorial or graphical representation of a solution to a problem. Special symbols with predefined meaning are used to construct the flowcharts. While creating flowcharts the following points have to considered : Every symbol should perform a specific job of input, output, decision or process unambiguously. There must be one start and only one stop. Every symbol should be linked with flow lines and there must not be any broken paths.

The basic symbols used in flowcharts :

Symbol

Purpose Used to indicate beginning or end of the program

Terminal Represents calculation, data manipulation or information processing. Process Input or Output Data or Information Input/Output Represents a comparison, a question or a decision that determines paths for the program flow Decision Represents the direction of processing or data flow Flow Lines

Example : Flowchart to check whether a given number is even or odd. Start Read N

R=N%2

R=0

Print Odd

Print Even

Stop

Flowcharttodisplayevennumbersbetweenarange(MandN)
Start

Accet M, N

I=M F I<=N T R=I%2

F R=0 T DisplayI

I=I+1

Stop

Вам также может понравиться