Applying greedy reasoning
Greedy reasoning is often used as part of an optimization process. The algorithm
views the problem one step at a time and focuses just on the step at hand. Every
greedy algorithm makes two assumptions:
»
You can make a single optimal choice at a given step.
»
By choosing the optimal selection at each step, you can find an optimal
solution for the overall problem.
You can find many greedy algorithms, each optimized to perform particular tasks.
Here are some common examples of greedy algorithms used for graph analysis
(see Chapter 9 for more about graphs) and data compression (see Chapter 14 for
more about data compression) and the reason you might want to use them:
Do'stlaringiz bilan baham: |