State the function of an Algorithm in Computer Programming

An algorithm is a step by step method of solving a problem.  It is an unambiguous specification of how to solve a class of problems. ... As an effective method, an algorithm can be expressed within a finite amount of space and time and in a well-defined formal language for calculating a function.  An algorithm in principle is simply a series of instructions that are followed step by step to solve some problem or do something useful. They have an input which goes through a series of computations, and finally produces an output.