Is it possible that a greedy
algorithm is also a dynamic programming
algorithm?
I took an Analysis of Algorithms
class but still, I am not sure with the two concepts.
I understand that the greedy approach uses the current optimal solution to find the global optimal solution and DP algorithm reuse the overlapping sub-results.
I believe the answer is "YES" but I couldn't find a good example which is both greedy and DP algorithm.
Could someone give me an example?
If the answer to the above question is "NO" then could someone explain to me why?
Is it possible that a greedy algorithm is also a dynamic programming algorithm?
, why not? what keeps me from preparing the sub-result in a greedy manner? – mangusta