Algorithms are the foundation and framework of all computer programs. They are the sequence of precise instructions given to a computer for achieving a desired output. Algorithms are to computer programs what the mind is to the human body. Many algorithmic design patterns or paradigms exist such as greedy algorithms, divideandconquer algorithms, dynamic programming algorithms and backtracking algorithms. Each class of algorithms has its own unique design structure.
Things You'll Need
 Paper
 Pen
 Pencil
 Eraser

Greedy algorithms are algorithms that provide decisions based on available information without any foresight. They work best in optimization problems and are easy to implement. The general steps for their design are:

Create a collection(list, set, etc) of candidates (C)

Find a Subset (S) from the collection of candidates(C)

Specify the criteria that S must satisfy.

If it meets that criteria (feasible), go ahead to Optimize S
 Optimizing S means selecting to minimize or maximize, depending on the particular problem. In the process we may select the largest or smallest solution.


DivideandConquer algorithms follow a topdown approach in algorithm design. They subdivide the problem into smaller problems and finally reassemble the solutions to the component problems.The general steps for their design are:

Define the problem

Create an instance of the problem

Divide this instance into smaller subinstances of the same problem

Solve each of the subinstances on its own
 Integrate and combine the solutions of the subinstances so as to obtain a solution for the original instance.


Dynamic programming algorithms are a variant of the divideandconquer algorithm. While the divideandconquer algorithms which are recursive follow a topdown approach to solving optimization problems, dynamic programming follows a bottomup technique. The general steps for their design are:

Define the problem

Create instances of the problem

Construct a table of all subinstances

Start with the smallest subinstances

Continue with increasing subinstance size adding results of entries already computed
 Continue till the last subinstance. The final obtained solution is the solution to the initially defined problem.
This method is iterative while the divideandconquer approach is recursive.


The backtracking algorithm systematically searches for a solution from available options, on the assumption that a solution exists. The general steps for their design are:

Start with an empty vector

Let the solution be represented by vectors (Vi......Vm)

Traverse the vectors, extending the partial vectors with a new value

Backtrack if a vector cant represent a partial solution

Remove the trailing value from the vector

Then proceed to extend the vector with alternative values
 Continue the process until a solution is found.

Tips & Warnings
 Try to find the type of algorithm that best solves your problem before you start algorithm design.
 Algorithm design is addictive but a beautiful experience. Don't start if you have other urgent things to do soon.
References
 Algorithm Design Foundations, Analysis, and Internet Examples by Michael T. Goodrich and Roberto Tamassia
 Univ. of Liverpool: Greedy Algorithms
 Univ. of Liverpool: DivideandConquer Algorithms
 Univ. of Liverpool: Design of Dynamic Algorithms
 Univ. of Liverpool:Backtracking and Searching
 Ohio State University: Backtracking and search Algorithms
 Photo Credit Jupiterimages/Photos.com/Getty Images Thinkstock/Comstock/Getty Images Brand X Pictures/Brand X Pictures/Getty Images Jupiterimages/Polka Dot/Getty Images