»
Against another algorithm when, as you see the greedy solution unfolding,
you notice that the greedy solution stays ahead of the other algorithm; that is,
the greedy solution always provides a better solution at every step than is
provided by another algorithm.
Even considering that it’s more the exception than a rule that a successful greedy
approach will determine the top solution, greedy solutions often outperform other
tentative solutions. You may not always get the top solution, but the solution will
provide results that are good enough to act as a starting point (as a minimum),
which is why you should start by trying greedy solutions first on new problems.
Do'stlaringiz bilan baham: |