Friday, August 23, 2013



An algorithm is a s What tep by step approach to solve any computational problem.


1.) FINITENESS : An algorithm must have finite number of steps, because if it has infinite number of steps(endless) then its of no use as it would never produce any expected output.
2.) DEFINITENESS : An algorithm must be definite in nature i.e. all the steps must be unambiguous.
3.) INPUT : An algorithm must at-least take an input to work on.
4.) OUTPUT : An algorithm must produce at-least one or more outputs as final result.


There are several approaches which are followed to have a computational solutions. These approaches are as follows :
1.) BRUTE FORCE TECHNIQUE : in this technique, all the available attempts are made to get a perfect solution for the existing problem. An analogy can be made with locker, where all the combinations are tried to open the locker.
2.) DIVIDE AND CONQUER : in this technique, a problem is divided into small modules and for each of those modules solutions are found recursively, which are further integrated to get the final desired output desired.
3.) GREEDY METHOD : in this technique, the easiest solution is tried to be found out. An analogy can be made with the popular travel salesman problem, in which a sales man has to travel several cities and his target is to choose such a path which cost him least and he doesn't have to repeat any city which he has already travelled. The solution to this kind of problem lies in selecting the shortest path which connects all cities. This kind of approach is followed in greedy methods.
4.) DYNAMIC PROGRAMMING : it is a design technique, in which a problem is divided into sub-problems and the subproblems are in turn dependent on each other for their solutions. The perfect example for this is the Fibonacci series, in which the subsequent number is found by adding the previous two numbers. e.g.

No comments:

Post a Comment