Pages

Translate

Showing posts with label American National Standard Institute. Show all posts
Showing posts with label American National Standard Institute. Show all posts

Monday, 18 June 2012

Guidelines For Writing Algorithms,Pseudocode And Flowcharts

Here are a few guidelines that will help you in writing an efficient algorithm:

  • An expected output should be decided by the programmer before writing an algorithm.
  • Each step in an algorithm should be written clearly,stating each task to be performed.
  • To be sure that the algorithm produces the expected output,it should be checked using sample values.
And a couple too for writing pseudocode,

  • Statements that are related should be combined to avoid writing a lengthy pseudocode. For example,
          display "Enter first number"
          accept number1
          display "Enter Second number"
          accept number2

The statements above make the for a lengthy pseudocode,it can be shortened by combining the statements. For example:
         display "Enter two numbers"
         accept number1,number2

  •  The pseudocode should be aligned properly for a clear understanding of the steps carried out.
Here are also rules recommended by the American National Standard Institute (ANSI) that are to be followed when drawing a flowchart.

  • The entire logic of a flowchart should be represented using standard symbols.
  • The flowchart should be clear,precise and easy to follow.
  • The flowchart should have only one start point and one end point.
  • The steps in a flow chart should follow top-to-bottom or left-to-right approach.
  • All necessary inputs should be listed in logical order.
  • The start and stop symbols should have only a single flow line.
  • The input,process,output and display symbols should have at least two flow line connecting to the previous symbol and to the next symbol.
  • The decision symbol should have one flow line flowing into it and two flow lines flowing out of it for each possible decision.
  • Flow charts should use page connectors if they extend over multiple pages.
  • It is useful to text the logic of the flowchart by texting the flowchart using some sample values.........