Dynamic Programming:
It just solves problems by combining the sub problems to solutions only of the sub problems were independent.
It can be used for solving both mathematical optimization method and computer programming method.
For example,it can be used for finding the shortest path in graph.
The algorithm used is:
Greedy Method:
Greedy method solves problems step by step which leads to global optimization solution.
Algorithm for greedy is:
Greedy(D,n)
//In Greedy approach D is domain
//from which solution is to be obtained of size n
//Initially assume
solution<-0
for i<-1 to n do{
s<-select(D)
if(Feasible solution,s))then
Solution<-Union(Solution,s)
}
return solution
Top comments (0)