Difference Between Greedy and Dynamic Programming

Difference Between Greedy and Dynamic Programming in Tabular Form

Greedy and Dynamic Programming Difference





The Key Difference Between Greedy and Dynamic Programming is in the below table.

Greedy and Dynamic Programming Comparison
Greedy and Dynamic Programming Comparison

Greedy vs Dynamic Programming Comparison Chart

Greedy Method Dynamic Programming
Greedy Method is used to get the optimal solution. Dynamic Programming is also used to obtain the optimal solution.
In a greedy method, the optimum solution is obtained from the feasible set of solutions. In dynamic programming, there is no special set of feasible solutions in this method.
In the greedy method, there is no guarantee of an Optimal Solution Dynamic Programming generates an Optimal Solution.
Greedy Method is less reliable Dynamic Programming is highly reliable
Greedy Method follows the Top-down approach. Dynamic Programming follows the Bottom-up approach.
More efficient Less efficient
Example: Fractional knapsack Example: 0/1 knapsack problem




More Difference