Greedy Analysis Strategies

Greedy Analysis Strategies

  • Greedy algorithm stays ahead.
    Show that after each step of the greedy algorithm, its solution is at least as good as other algorithm’s.
    Ex.Interval scheduling

  • Structural.
    Discover a simple “structural” bound asserting that every possible solution must have a certain value. Then show that your algorithm always achieves this bound.
    Ex.Interval partitioning

  • Exchange argument
    Gradually transform any solution to the one found by the greedy algorithm without hurting its quality.
    Ex.Minimizing lateness

Remark.
Greedy algorithm do not always give an optimal solution but can produce a solution that is guaranteed to be close to optimal.

Basic Elements of Greedy Algorithm

Usually, if the given problem has the following ingredients(hallmark in other teaching material, Steve add this note), then it is more likely to develop a greedy algorithm for it.

  • Greedy-choice property.
    A locally optimal choice is globally optimal。

We can assemble a globally optimal solution by making locally optimal(greedy) choices. That is, when we make the choice that looks best in the current problem, without considering results from subproblems.

  • Optimal substructure.
    A problem exhibits optimal substructure if an optimal solution to the problem contain within it optimal solutions to subproblems.

注意,这里的最优子结构和动态规划的hallmark 1是一样的。事实上,贪心法解决不了的问题,可以尝试使用动态规划来解决。

在这里插入图片描述
0-1背包问题,有最优子结构,但使用贪心法无法解决,需要使用动态规划。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值