»
At each turn, you always make the best decision you can at that particu-
lar instant.
»
You hope that making a series of best decisions results in the best final
solution.
Greedy algorithms are simple, intuitive, small, and fast because they usually run
in linear time (the running time is proportional to the number of inputs provided).
Unfortunately, they don’t offer the best solution for all problems, but when they
do, they provide the best results quickly. Even when they don’t offer the top
answers, they can give a nonoptimal solution that may suffice or that you can use
as a starting point for further refinement by another algorithmic strategy.
CHAPTER 15
Do'stlaringiz bilan baham: |