An algorithm is defined as a step by step procedure for solving a problem. It is an ordered set of rules to solve a problem. An algorithm is a representation of a solution to a problem. It is a well-defined computational procedure consisting of a set of instructions that takes some value or set of values, as input, and produces some value or set of values, as output. Algorithm must terminate after a finite number of steps and further each steps must be executable in finite amount of time.