为什么这是一个贪心算法? [英] Why is this a greedy algorithm?

查看:175
本文介绍了为什么这是一个贪心算法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的课本了这个问题:

I have this question in my text book:

假设我们有一系列的活动中大安排 演讲大厅,在那里的活动可以发生在任何报告厅的数量。我们希望所有的安排使用尽可能少演讲厅尽可能的活动。给出一个有效的贪心算法来确定哪些活动应该使用哪个报告厅。

" Suppose that we have a set of activities to schedule among a large number of lecture halls, where any activity can take place in any lecture hall. We wish to schedule all the activities using as few lecture halls as possible. Give an efficient greedy algorithm to determine which activity should use which lecture hall. "

和答案就在这里给出: <一href="http://mit$p$pss.mit.edu/algorithms/solutions/chap16-solutions.pdf">http://mit$p$pss.mit.edu/algorithms/solutions/chap16-solutions.pdf

And the answer is given here: http://mitpress.mit.edu/algorithms/solutions/chap16-solutions.pdf

(杉杉溶液)

和我的答案是,为什么是算法贪心算法?

And my answer is, why is the algorithm a greedy algorithm?

我认为,这是因为它使(贪婪?)的选择,你总是需要一个活动,并把它变成一个报告厅,那里已经是一个或多个活动(如果可能的话),而不是把活动成一个新的空报告厅。但我不知道。 :)

I think that it is because it makes the (greedy?) choice that you always take an activity and put it into a lecture hall, where there already is one or more activities (if possible), instead of putting the activity into a new empty lecture hall. But I am not sure. :)

推荐答案

,你不考虑你的选择贪婪的手段。这使得它很难拿出一个最佳的解决方案,并介绍了该算法存在。

Greedy means that you don't reconsider your choices. that makes it very hard to come up with an optimal solution, and it describes the algorithm there.

这篇关于为什么这是一个贪心算法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆