Showing posts with label Algorithms. Show all posts
Showing posts with label Algorithms. Show all posts

Tuesday, November 26, 2013

Introduction to algorithms

This is the first article in my series on algorithms. Hopefully this would be helpful to someone.

What is an algorithm?
The word algorithm comes from a persian author Abu Jafar Mohammed ibn Musa al Khowarizmi. It is formally defined as : "An algorithm typically refers to a set of instructions that can be executed by a computer to produce the desired result" or "An algorithm is any well defined computation procedure that takes some value or set of values as output".

What are the properties of algorithms?
According to D.E.Knuth a pioneer in the computer science discipline an algorithm must have the following five properties:

a) Input : An algorithm has zero or more inputs, which are given to it initially either before it begins operation or dynamically as the algorithm runs. Input refers to data that is supplied to the algorithm on which the computation is performed.

b) Output : An algorithm has one or more outputs that have a specified relation to the inputs.

c) Definiteness : Each step of an algorithm must be precisely defined. Meaning that the actions to be carried out must be rigorously and umambiguosly specified for each case. Operations such as "compute 5/0" are not permitted because it is not clear what the result is.

d) Finiteness : The algorithm must terminate after a finite number of steps.

e) Effectiveness :  An algorithm must also be effective. This means that the operations must be sufficiently basic so that in principle anybody can do them using a pencil and paper. Performing arithemetic on integers is an example of an effective operation but the same is not true for performing arithemetic on real numbers.