There are many ways to describe an algorithm. They can be described in words simply using language or in diagram form. After a solution to a problem has been designed a computer programmer will code the algorithm into a suitable computer language.
Flowcharts are a pictorial way of describing an algorithm. Images are much easier for humans to respond to compared to text. The use of flow lines in a flowchart can result in the chart becoming very complex which in turn makes it difficult to translate into a programming language.
There are 5 common symbols in flowcharts.
1. Start or finish. This symbol has one flow line into it or one out. Flowcharts should always start and end with this symbol.
2. Process. The body of the flowchart is composed of processes. A process has one flow line in and one flow line out.
3. Decision. This symbol has one flow line in and one flow line out.
4. Pre-defined process. A process that is described in its own flowchart. A pre-defined process has only one entry and one exit.
5. Flow lines. Flow lines are used to indicate the direction the process is flowing. They will generally have arrow heads at the end point.
Pseudocode
Psedocode consists of keywords, symbols and English and is indented to show structure. Being that there are no flowlines means that the structure is kept simple and it is therefore easy to code into a programming language. The keywords in pseudocode occur in pairs or in groups. The most common ones are listed below.
BEGIN
Start the algorithm.
END
Stop the algorithm
IF THEN
ELSE
ENDIF
These statements test a condition and perform different tasks according to the condition.
CASEWHERE
OTHERWISE
ENDCASE
These keywords are used instead of IF… ENDIF when there are multiple conditions to test and/or multiple answers to the test.
WHILE
ENDWHILE
The statements between these keywords are executed repeatedly while a condition is true.
REPEAT
UNTIL
The statements between these keywords are executed repeatedly until a condition becomes true.