greedy algorithms Flashcards
1
Q
when should greedy programming be used
A
when the problem is straightforward, and locally optimal choices at every step also lead to a globally optimal solution
particularly good for optimization problems with clear constraints
tends to be more efficient than dynamic programming, but may not always yield optimal solutions
1
Q
what is a greedy algorithm
A
Always pick the next best choice. Cannot go back once a choice is made.
Major Steps:
1. Select a best choice from the set of available choices
2. Check whether the selected choice satisfies constraints
3. Iteratively repeat Steps 1 and 2 until no choice can be selected