Wednesday, October 8, 2008

Algorithms

Algorithm is a set of instructions that is undertaken when solving a problem. In writing algorithms, you don’t need to follow any format or any type of language, you can write which way you want and you don’t need to conform to any language.

There are two ways of writing an algorithm. First is Pseudo code writing where you just have to write the process step by step or number by number. The other one is Flow chart writing where you write keywords inside symbols that are connected via flow lines.

In Flow chart writing, you first need to know the symbols and what that symbol does. The Terminal symbol, which is an oblong shape, denotes the beginning and the end of the flowchart. Always remember that in writing Flow chart, you can just have one beginning terminal symbol but you can have two or more ending terminal symbol. The Input/output symbol, which is a parallelogram, is used when you need interaction with user. The processing symbol, which is a rectangle shape, is used when you don’t need interaction with the user and when you need to write equations. The decision symbol, which is a diamond, has the question that is answerable by yes or no. The preparation symbol, which is a hexagon, is where you place initialization/when you assign starting values on a variable. Flow direction lines, which are arrow heads, guides the flow of the flow chart. On-page connector, which is a circle, connects symbols that are far from each other but within the same page. It also help to eliminate cross lines in a flow chart. Off-page connector are used to connect symbols that are in different pages. Last symbol is the Flow lines, which is a straight line. Flow lines are used to connect all symbols and is used to know the sequence of the flow chart.

No comments: