ON ALGORITHM
Done by
Densil Hamilton
INTRODUCTION
This Assignment was done to show the methods of algorithm. It outlines the meaning of algorithm and steps to be carried out to complete a give problem. Examples were also shown for the methods of representing algorithm.
What is an Algorithm?
An algorithm consists of a set of explicit and unambiguous finite steps which, when carried out for a given set of initial conditions, produce the corresponding output and terminate in finite time. (How to Solve it by Computer, RG Dromey, Prentice Hall UK, 1982)
This is done by a series of steps:
1. Input: there are zero or more quantities which are externally supplied;
2. Output: at least one quantity is produced;
3. Definiteness: each instruction must be clear and unambiguous; 4. Finiteness: if we trace out the instructions of an algorithm, then for all cases the algorithm will terminate after a finite number of steps; 5. Effectiveness: every instruction must be sufficiently basic that a person using only pencil and paper can in principle carry it out. It is not enough that each operation is definite, but it must also be feasible.
WAYS OF REPRESENTING ALGORITHMS
Two ways of represent an algorithm are:
Flowcharts
Pseudo Code
FLOWCHARTS
This is a diagrammatic representation of the sequence of steps needed to perform a task. They show the sequence of operations, movements, decisions and storage activities within a system. It is a diagram that is made up of boxes, diamonds and other shapes, connected by arrows that each shape represents a step in the process, and the arrows show the order in which they occur.
PSEUDO CODE
This is essentially English with some defined rules of structure and some keywords that make it appear a bit like program code.
Advantages and Disadvantages of Representing Methods
FLOWCHART
An advantage of a Flowchart is: it is easy to understand by