Programs are Algorithms
What is a program?
"A set of statements that can be submitted as a unit to some computer system 
and used to direct the behaviour of that system."               (Oxford Reference)
Typical functions include:

Programs are Algorithms

a program is an expression of an algorithm in a computer language.

Algorithms - General Features

An algorithm consists of a finite set of rules giving a sequence of operations 
for solving a specific type of problem.

Characteristics of an Algorithm

 
Finiteness - must terminate after a finite number of steps 
(and actually we mean 'very' finite, a reasonable number of steps)
Definiteness - each step must be precisely and unambiguously defined
Input - zero or more inputs from a legal set
Output - one or more outputs, specified as a function of the inputs
Effectiveness  - all actions can in principle can be executed exactly and in finite time 
(by a person - using pencil and paper)
An algorithm, 
composed from elementary instructions belonging to a prescribed set, 
solves a problem by producing the required output when when given a legal input set.


Algorithms - Some Examples

An (informal) algorithm to sum a list of salaries

  1. Set TOTAL-SO-FAR to 0
  2. Proceed through salary list, ADDing each employee's SALARY to TOTAL-SO-FAR
  3. At end of salary list, OUTPUT TOTAL-SO-FAR
  4. Finish

Euclid's algorithm

To find greatest common divisor of two positive integers M and N
  1. (get input) Get values for M and N
  2. (find remainder) Divide M by N and let R be the remainder.
  3. (is remainder zero?) If R = 0, stop with N as output.
  4. (interchange) Set M equal to N and N equal to R, go back to step 1.
  5. stop
Algorithms - Real-world Procedures: Cooking example
HOLLANDAISE SAUCE 
(from Delia Smith's 'Complete Cookery Course')
Description 
famous French butter sauce, good with fresh vegetables... 
Ingredients 
for the reduction - 2 tbsp white wine vinegar, 3 tbsp water, 1 slice onion, 1 blade mace, half small bay leaf, 6 black peppercorns;

for the sauce -1 tbsp water, 3 egg yolks, 6oz unsafted butter at room temperature, lemon juice to taste, salt and freshly milled black pepper 
Instructions 
  • Place first 6 ingredients together in small saucepan and simmer gently (uncovered) until the mixture is reduced to about 1 tablespoon - keep your eye on it because it can boil away before you know it! 
  • Then strain the reduced mixture into a bowl, add a further tablespoon of water and a little seasoning. 
  • Whisk in the egg yolks. 
  • Next place the bowl over a pan of barely simmering water, and add half oz of the butter, whisking until it has melted and the mixture has thickened slightly. 
  • Carry on adding lumps of butter - approx half oz at a time - and allow the butter to melt and the mixture to thicken before adding any more. 
  • When all the butter is in, carry on whisking and cooking gently for a further 2 minutes. 
  • Then remove the bowl from over the water, taste, and add lemon juice and seasoning as required.
  • If the mixture curdles (which it will do only if overheated) place a fresh egg yolk in a clean bowl and gradually whisk in the curdled mixture to bring it back.

Regular procedures for effectively achieving desired outcomes are commonplace in everyday life.

Some examples:

Note that certain common elements will be found in the examples: 'Algorithms in action' could be a description of the many learned activities which people take for granted, but which are based on sets of defined steps to produce a desired result.
For example: making a cup of coffee, driving a car etc., etc.
 
KHWARIZMI, AL- (c. 780-c. 850?), 
  • Arab mathematician, born in Khwarizm (now Khiva, Uzbekistan). 
  • He was librarian at the court of Caliph al-Mamun (786-833) and astronomer at the Baghdad observatory. 
  • His works on algebra, arithmetic, and astronomical tables greatly advanced mathematical thought, and he was the first to use for mathematical purposes the expression al jabr, from which the English word algebra is derived. 
  • The Latin version, by the Italian translator Gerard of Cremona (1114?-87), of his treatise on algebra (based on a Hindu work) was responsible for much of the mathematical knowledge of medieval Europe. 
  • His work on algorithms, a term derived from his name, introduced the method of calculating by use of Arabic numerals and decimal notation.                 (Infopedia CD)
Tony Drewry
 
Tony's Home Page