设为首页
收藏本站
联系我们

 

首页 国际机票 国内机票 出国留学 出国移民 出国劳务 出国旅游 出国新闻 海外生活 目的地指南 

24小时订票热线

 

 电话:020-22858118(国内)
        020-22858008(国际)
 传真:020-22858007 
 在线QQ:644903113(国内)
 在线QQ:493932973(国际)
E-mail:gzhuafeng@126.com

便民工具箱
汇率查询 机票真伪查询
电子年历 机型介绍
火车查询 机场快线
广州天气 邮编区号
国际时差 登机流程
电子地图 公众服务电话
支付方式 交通指南

== 订票指南 ==

中国机票折扣网网上订票须知
哪些物品被禁止出境?
如何获取电子客票报销凭证
购买电子客票要注意三防
旅客变更机票如何处理
哪些物品被禁止入境?
哪些行李物品不能运输?
如何托运小动物?
为什么旅客误机时要将其行李卸
行李托运有哪些手续?
在什么条件下旅客的免费行李额
乘机有效身份证件
更多...

英国IT业找工作面试题

上海特价机票 北京特价机票 成都特价机票 深圳特价机票

友情提示 递归算法简单但速度慢

请在两天内作答。

Elixent’s Placement Problem

Write a program (in C or C++) that places an arbitrary netlist represented as a directed graph G = (V, E) with vertices V and edges E over a 1D array of N processors:

p_1 p_2 p_3 ... p_N

Each vertex should be placed on a single processor and no processor can hold more than one vertex (you can assume there are as many processors as you need). For example vertex v_1 might be placed on processor p_1 and v_2 on p_4:

-----------

v_1 v_2

p_1 p_2 p_3 p_4 ... p_N

If there were an edge between v_1 and v_2, then it would automatically be routed along the 'shortest' path between the respective processors (as shown). The distance of this edge is 4-1 = 3. The cost of an overall placement is simply the sum of all edge distances. Placements with lower cost as these are 'better', but the computational complexity of your placement algorithm also matters (you might need to place very large netlists).

The graph should be read in from standard input in the form

10

1,3 2,4 4,5 ...

In the first line '10' gives the number of vertices, the second line defines which pairs of vertices are connected by edges (the first vertex is numbered 1).

The program should output the placement cost and results on standard output, giving the vertex allocated to each processor in turn, or - if a processor is empty. For example:

21

2 4 - 3 1 ...

would mean the placement cost was 21 and vertex 2 was allocated to p_1, 4 to p_2, p_3 was empty, 3 to p_4 etc.

You might optionally want to consider a more complex problem with a non-linear notion of cost that accounts for congestion in the case when there are multiple overlapping edges. For example, the cost function could be redefined as the sum of the squares of the number of edges spanning each pair of neighbouring processors. In this case the following configuration of edges:

--- ---

-----------

p_1 p_2 p_3 p_4 p_5 .... p_N

would have cost:

1 edge spanning p_1 to p_2

2^2 edges spanning p_2 to p_3

1 edge spanning p_3 to p_4

1 edge spanning P_4 to p_5

---

7

Again, lower cost is better, but computational complexity also matters.

 

上一篇: 求职招聘会探虚实
下一篇: 三道加拿大的道德测试题

 

票提示:本站公布的机票票价为人民币结算,不包含任何税项与刷卡/汇款手续费。具体以出票时确认为准。
 
公司简介 

-

诚聘英才

-

联系方式 

-

友情联链  - 免责声明

-

合作伙伴 
 

本站由:商旅在线网 网站建设  版本所有:广州华枫商务服务有限公司 管理登陆

公司地址:广州市白云区机场路575号穗景大厦A座大堂右侧(即机场生活区)

电话:400-700-2272(全国),020-86078802(广州) 传真:020-86078955 值班手机:13302302010  E-mail: gzhuafeng@126.com