单项选择题

【案例分析题】

现需要申请一些场地举办一批活动,每个活动有开始时间和结束时间。在同一个场地,如果一个活动结束之前,另一个活动开始,即两个活动冲突。若活动A从1时间开始,5时间结束,活动B从5时间开始,8时间结束,则活动A和B不冲突。现要计算n个活动需要的最少场地数。
解该问题的基本思路如下(假设需要场地数为m,活动数为n,场地集合为P1,P2,...,Pm),初始条件Pi均无活动安排:
(1)采用快速排序算法对n个活动的开始时间从小到大排序,得到活动a1,a2,...,an。对每个活动ai,i从1到n,重复步骤(2),(3),(4);
(2)从P1开始,判断ai与P1的最后一个活动是否冲突,若冲突,考虑下一个场地P2,...;
(3)一旦发现ai与某个Pj的最后一个活动不冲突,则将ai安排到Pj,考虑下一个活动;
(4)若ai与所有已安排活动的Pj的最后一个活动均冲突,则将ai安排到一个新的场地,考虑下一个活动;
(5)将n减去没有安排活动的场地数即可得到所用的最少场地数。

整个算法的时间复杂度是()。

A.θ(lgn)
B.θ(n)
C.θ(nlgn)
D.θ(n2

题目列表

你可能感兴趣的试题

单项选择题

【案例分析题】

完形填空:下面短文有5处空白,请根据短文内容为每处空白确定1个最佳选项。
Creating a clear map of where the project is going is an important first step. It lets you identify risks, clarify objectives, an determine if the project even makes sense. The only thing more important than the Release Plan is not to take it too seriously. 
Release planning is creating a game plan for your Web project (71)what you think you want your Web site to be. The plan is guide for the content, design elements, and functionality of a Web site to be released to the public, to partners, or internally. It also (72)how long the project will take and how much it will cost. What the plan is not is a functional (73)that defines the project in detail or that produces a budget you can take to the bank. 
Basically you use a Release Plan to do an initial sanity check of the project’s (74)and worthiness. Release Plans are useful road maps, but don’t think of them as guides to the interstate road system. Instead, think of them as the (75)used by early explorers-half rumor and guess and half hope and expectation. 
It’s always a good idea to have a map of where a project is headed.

71、()

A.constructing
B.designing
C.implementing
D.outlining

微信扫码免费搜题