Content deleted Content added
Added links Tags: canned edit summary Mobile edit Mobile app edit |
|||
Line 2:
{{Disputed|date=November 2015}}
In [[
Dynamic programming algorithms are often used for [[optimization]]. A dynamic programming algorithm will examine the previously solved subproblems and will combine their solutions to give the best solution for the given problem. In comparison, a [[greedy algorithm]] treats the solution as some sequence of steps and picks the locally optimal choice at each step. Using a greedy algorithm does not guarantee an optimal solution, because picking locally optimal choices may result in a bad global solution, but it is often faster to calculate. Fortunately, some greedy algorithms (such as [[Kruskal's algorithm|Kruskal's]] or [[Prim's algorithm|Prim's]] for [[minimum spanning tree]]s) are proven to lead to the optimal solution.
|