Lecture 25 - Greedy Algorithms
Lecture 25 - Greedy Algorithms
Lecture # 25
Optimization Problems
⚫ Some problems can have many possible/ feasible
solutions with each solution having a specific cost. We
wish to find the best solution with the optimal cost.
⚫ Maximization problem finds a solution with
maximum cost
⚫ Minimization problem finds a solution with
minimum cost
⚫ Invest on stocks
Greedy Algorithm
⚫ How to know if a greedy algorithm will solve a
particular optimization problem?
⚫ Two key ingredients
⚫ Greedy choice property
⚫ Optimal sub-structure
5
Greedy Algorithm
⚫ Greedy choice property: A globally optimal solution can
be arrived at by making a locally optimal (greedy) choice
⚫ Make whatever choice seems best at the moment and then solve
the sub-problem arising after the choice is made
⚫ The choice made by a greedy algorithm may depend on choices
so far, but it cannot depend on any future choices or on the
solutions to sub-problems