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 vs Dynamic Programming Comparison Chart
|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.
|Example: Fractional knapsack
|Example: 0/1 knapsack problem
- Difference Between Divide and Conquer and Dynamic Programming
- Difference between Sequential Search and Binary Search