{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Notes-592-ch16-L-05

# Notes-592-ch16-L-05 - SHEN'S CLASS NOTES Chapter 16 Greedy...

This preview shows pages 1–3. Sign up to view the full content.

SHEN’S CLASS NOTES 1 Chapter 16 Greedy Algorithms Like the dynamic programming, greedy algorithms are used to solve optimization problems also. Examples of optimization problems: (1) Find the largest number among n numbers. (2) Find the minimum spanning tree (MST) for a given graph. (3) Find the shortest path from vertex a to vertex z in a graph. A greedy algorithm works in stages also: (1) Initially, the greedy algorithm provides a simple partial solution (or a feasible solution) to the problem. For example, it can start with a single vertex for the MST problem. (2) At each stage, the greedy algorithm grows the current feasible or partial solution from previous stage to a larger, better, or more complete solution. After a number of stages, the algorithm stops when: (1) An optimal solution is obtained in O( f ( n )) time. In this case, we say that the algorithm solves the problem in O( f ( n )) time. (2) A good but sub-optimal solution is obtained. In this case, we say that this is an approximation algorithm.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document