Algorithms and Flowcharts
An algorithm is a sequence of steps used to complete a task.

Algorithms may be presented...

  • in words
  • as a flowchart
  • in structured code  

A computer program is an algorithm written for a computer in a special programming language.

 

The word 'sequence' implies there is an order to the steps.
Example in words :
Go straight on to the traffic lights, turn left and take the third turning on the right. If the red gate is open then go through it, otherwise go through the green gate.

Example as a flowchart :
 

Flowcharts have terminators (Start and Stop boxes)...and the algorithm is determined by direction on the flow lines. 

Decision boxes are diamond shaped.

Example in structured code :

 

Go straight on to the traffic lights;
Turn left;
Take the third turning on the right;
If the red gate is open then 
     go through the red gate
else 
     go through the green gate
end if;

Each line is executed in turn...
Exercise : Algorithms and Flowcharts
An algorithm is a sequence of which are followed in order to complete a task.

An algorithm may be written down as for a computer, or as a .

 

(Green indicates success)