Algorithms and Flowcharts

An algorithm is a description of how to carry out a process. An algorithm lists the steps that must be followed to complete the process. Algorithms can be described in English but such descriptions are often ambiguous and open to misunderstanding. Therefore various formal methods of describing algorithms have been developed. The simplest of these is the flowchart.

A flowchart consists of a sequence of instructions linked together by arrows to show the order in which the instructions must be carried out. Each instruction is put into a box. The boxes are different shapes depending upon what the instruction is. The main four types of box are :

Flowcharts are often used to describe in detail algorthms that will be carried out by a computer. When a computer carries out an algorithm the computer is said to execute the algorithm. Execution is also sometimes referred to as running.

Here are some example situtations in which flowcharts are often used :

Sometimes a more general view of how an information system will operate is required. A flowchart for a complete information system would cover many pages of paper and would be very difficult to produce and understand. A more general description of how an information system operates can be given by using a system flowchart.

Example Flowcharts 

Flowchart Example One : Simple Greenhouse Temperature Control System

A greenhouse temperature control system consists of :

The system is used to keep the temperature of the greenhouse above 20°C. If the temperature drops below 20°C then a heater is turned on to warm the greenhouse up.

The system uses two devices :

Input SensorsOutput Devices
Temperature SensorHeater

The operation of the system is described by this flowchart :

Flowchart Example Two : Macro To Sort A Football League Table

A spreadsheet has been created which shows the league positions of some football teams in a league. Whenever a team plays a match the team's points score and position in the league may change. After each match the league table must be sorted to put the teams in the correct order. The actions required to complete this task in the spreadsheet are :

A macro has been created to automate this process. The macro is described by this flowchart :

System Flowcharts

Flowcharts describe in detail how a process will be carried out. Sometimes during the development of an information system it is useful to be able to produce a more general description of how a system will work. A system flowchart shows in general terms the operations that will be performed on information in an information system. The arrows on a system flowchart show the direction that data will flow in around the system rather than the order in which the operations will be carried out.

Many more symbols are used on a system flowchart than on a normal flowchart. These are the symbols that may be used :

System Flowchart Example : Car Repair Garage

A car repair garage uses a computer system to produce invoices and keep track of the parts it has in stock. The system uses two files :

When a repair is completed the mechanic records the parts that were used on a form. These parts are then entered into the computer by an operator. The list of parts that is entered is checked against the stock list to reduce the likelihood of the operator making a mistake. If the operator enters the name of a part that does not exist then an error report is displayed. When the parts list has been entered the cost of the parts is looked up in the stock file and an invoice (bill) is printed for the customer.

Every night the computer system checks the stock file. A report is printed to indicate which parts need to be ordered from the garage's suppliers. Details of any orders are placed in the orders file.

When a delivery of new parts is made to the garage the person making the delivery gives the garage a delivery note. The delivery note contains a list of the parts that have been delivered. The list of new parts is entered into the computer by an operator. If any parts have been delivered that were not ordered then an error report is printed. When an order is delivered the information about the order is removed from the orders file and the stock file is updated.

The structure of this system can be shown using the following system flowchart :

Questions

(1)Explain these important terms :

a) Algorithm
b) Flowchart
c) System Flowchart

(2)What is the difference between a flowchart and a system flowchart ?
(3)Why are flowcharts usually used to describe algorithms instead of written descriptions ?
(4)Flowcharts can also be used to describe activities that humans carry out. Draw a flowchart for one of these activities :

a) Making a telephone call.
b) Making a cup of tea.
c) Repairing a bicycle tyre.

Include as much detail as possible.

(5)Choose an information system such as a spreadsheet or database that you have created. Draw either a system flowchart or a flowchart to explain how the system operates.

(C) P. Meakin 1998