Greedy Algorithm is one of the intuitive algorithms that appear not complicated to understand. As indicated by its name, greedy algorithm picks up the extreme values for each step since the beginning. Thus, greedy algorithm is only valid when the optimal of every step, or the optimal on the fly, is guarantee to be true, which is usually not.
The interesting part is that, when the greedy algorithm is valid to a question, it is usually not difficulty to "find it". However, it is not rare that the proving of the valid is not straightforward. One of the ways to prove the correctness is proof by contradiction.
To make a brief summary:
1. greedy algorithm requires the correctness to pick up the extreme value for each step;
2. the proof of the validity of greedy algorithm usually is not easy.
Comments
Post a Comment