What is the difference between dynamic programming and greedy approach?

前端 未结 6 2391
忘掉有多难
忘掉有多难 2020-12-12 10:10

What is the main difference between dynamic programming and greedy approach in terms of usage?

As far as I understood, the greedy approach sometimes gives a

6条回答
  •  渐次进展
    2020-12-12 10:57

    I would like to cite a paragraph which describes the major difference between greedy algorithms and dynamic programming algorithms stated in the book Introduction to Algorithms (3rd edition) by Cormen, Chapter 15.3, page 381:

    One major difference between greedy algorithms and dynamic programming is that instead of first finding optimal solutions to subproblems and then making an informed choice, greedy algorithms first make a greedy choice, the choice that looks best at the time, and then solve a resulting subproblem, without bothering to solve all possible related smaller subproblems.

提交回复
热议问题