ADA 7.1: Greedy Algorithms
Textbook Chapter 16 - Greedy Algorithms
Textbook Chapter 16.2 - Elements of the greedy strategy
What is Greedy Algorithms?
- Always makes the choice that looks best at the moment
- Makes a locally optimal choice in the hope that this choice will lead to a globally optimal solution
- DP v.s Greedy
Dynamic Programming |
Greedy Algorithms |
has optimal substructure |
has optimal substructure |
make an informed choice after getting optimal solutions to subproblems |
make a greedy choice before solving the subproblem |
dependent or overlapping subproblems |
no overlapping subproblems |
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
|
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
|
Greedy Algorithms
To yield an optimal solution, the problem should exhibit:
- Optimal Substructure: an optimal solution to the problem contains within its optimal solutions to subproblems
- Greedy-Choice Property: making locally optimal (greedy) choices leads to a globally optimal solution
Proof of Correctness Skills
-
Optimal Substructure:
台大資訊 演算法 | ADA 5.1: Dynamic Programming 動態規劃
-
Greedy-Choice Property:
- Show that it exists an optimal solution that “contains” the greedy choice using exchange argument
- For any optimal solution OPT, the greedy choice g has two cases
- g is in OPT: done
- g not in OPT: modify to , contains g and is at least as good as
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →