Difference Between Greedy and Dynamic Programming in Tabular Form
Contents
Greedy and Dynamic Programming Difference
The Key Difference Between Greedy and Dynamic Programming is in the below table.
![Greedy and Dynamic Programming Comparison](https://alldifferences.net/wp-content/uploads/2022/04/Difference-Between-Greedy-and-Dynamic-Programming-394x308.png)
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
- Difference Between Divide and Conquer and Dynamic Programming
- Difference between Sequential Search and Binary Search