NTU-Exam 板


LINE

课程名称︰演算法设计与分析 课程性质︰资工系 大二 必修 课程教师︰蔡欣穆 开课学院:电机资讯学院 开课系所︰资讯工程学系 考试日期(年月日)︰2015/01/15 考试时限(分钟):180分钟 试题 : 132 points in total Problem 1. In each of tje following question, please specify if the statement is true or false. If the statement is true, explain why it is true. If it is false, explain what the correct answer is and why. (40 points. For each question,1 point for the true/false answer and 3 points foe the explaination.) 1. If L ∈ NPC and L ∈ P, then P = NP _ 2. If L ∈ NP then L ∈ NP. _ 3. If L ∈ P then L ∈ P. 4. If P = NP then NP = co-NP. 5. NPC ⊆ NP. 6. NP ⊇ P. For the following 4 questions, please refer to DFS(G) and DFS-VISIT(G,v) after the problem description. 7. There is no back edge in terms of the depth-first forest produced by a DFS on an undirected graph. 8. There is no cross edge in terms of the depth-first forest produced by a DFS on an undirected graph. 9. There is no back edge in terms of the depth-first forest produced by a DFS on a directed acyclic graph. 10. In DFS, when we visited an edge e = (u,v), if v's color is BLACK and u.d < v.d, then e is a cross edge. DFS(G) 1 for each vertex u ∈ G.V 2 u.color = WHITE 3 u.pi = NIL 4 time = 0 5 for each vertex u ∈ G.V 6 if u.color == WHITE 7 DFS-VISIT(G,u) DFS-VISIT(G,u) 1 time = time + 1 2 u.d = time 3 u.color = GRAY 4 for each v ∈ G.Adj[u] 5 if v.color == WHITE 6 v.pi = u 7 DFS-VISIT(G,v) 8 u.color = BLACK 9 time = time + 1 10 u.f = time Problem 2. Briefly explain in evidence-based scheduling how you can "simulate the future" ─ use the past history to estimate the time require to complete a task. (6 points) Problem 3. Please answer the following questions related to minimum cost spanning tree (MST) of connected graph G = (V,E). (24 points) 1. Please write down the pseudo code of Kruskal's algorithm. (4 points) 2. Please show that your algorithm in the previous problem runs in O(|E|log|E|). You can assume that running m of the following operations: MAKE-SET(v), FIND-SET(v), and UNION(u,v), takes O(mα(n))-time, where n is the number of MAKE-SET(v) operations, and α(n) is a very slowly growing function that α(n) ≦ 4 in all practical situations. (4 points) 3. Suppose that all edge weights in a graph are integers in the range from 1 to |V|. Please give a modified Kruskal's algorithm and show that is runs in O(|E|α|V|). (4 points) 4. Please write down the pseudo code of Prim's algorithm. (4 points) 5. Please show that your algorithm in the previous problem runs in O(|E|log|V|). (4 points) 6. Suppose that all edge weights in a graph are integers in the range from 1 to some constant W. Please give a modified Prim's algorithm and show that it runs in O(|E|). (4 points) Problem 4. We would like to implement a dynamic table data structure that supports two operations, TABLE-INSERT and TABLE-DELETE. TABLE-INSERT looks at the table to check if it is full. If not, then the item is directly inserted to the table. Otherwise, it doubles the size of the table, moves all data from the old table to the new table. TABLE-DELETE will remove the item from the table. If after the removal the table is less than 25% full, then it halve the table size and move all data from the old table to the new table. Assume that allocating the table space takes negligible time. Inserting, removing, or moving an item takes one unit if time. Show that the amortized cost of the two operations are both bounded above by a constant using the potential method. The potential function is given by 2 x T.num - T.size if T.num/T.size ≧ 1/2 Φ(T) = { T.size / 2 - T.num if T.num/T.size < 1/2 where T.num is the number of items in the table and T.size is the size of the table. Note that you need to discuss different cases, including the ones that do not involve table expansion or contraction and the ones that do.(16 points) Problem 5. In this problem, we ask you to answer the following questions related to an directed graph G shown in Figure 2. (16 points) Figure 2. http://imgur.com/i47tCKL 1. Please use the Dijkstra Algorithm to determine the costs of the shortest path (the number next to the edges in the graph are the costs for travelling through them) from vertex 1 to all other vertices. Use Table 1 to show how the algorithm is executed in each iteration. (6 points) 2. Please use the Bellman-Ford Algorithm to determine the costs of the shortest path (the number next to the edges in the graph are the costs for travelling through them) from vertex 1 to all other vertices. Use Table 2 to show how the algorithm is executed in each iteration. (6 points) 3. Explain why Dijkstra Algorithm cannot handle edges with negative weights. (4 points) Problem 6. In this problem,we ask you to prove that NODE-COVER is NP-complete. The problem description is as follows. Given a graph G = (V,E), we say N ⊆ V, a vertex set, is a node cover for G if every edge in E has at least one end in N. The problem NODE-COVER is: given a graph G and a "budget" k, does G have a node cover of k or fewer nodes? (20 points) 1. Please show that NODE-COVER ∈ NP. (4 points) 2. To show that NODE-COVER is NP-hard, we will construct a reduction function f(x) that reduces an instance of 3-CNF-SAT to an instance of NODE-COVER, described as follows. (a) Create G with the following description. For each clause (xVyVz) in the 3-CNF fornula, construct a "column" of three nodes, all connected by vertical edges. Add a horizontal edge between nodes that represent any variable and its negation. (b) Let the budget k be twice the number of clauses. Example: (xVyVz)Λ(~xV~yV~z)Λ(xV~yVz)Λ(~xVyV~z) is reduced to G shown in Figure 1 with k = 8. Figure 1. http://imgur.com/dXvJvUF Please show that this reduction is correct, i.e., x ∈ 3-CNF-SAT if and and only if f(x) ∈ NODE-COVER. (12 points) Please also briefly explain why the reduction algorithm that calculates f(x) runs in polynomail time. (4 points) Problem 7. Out of all the lectures this semester, which one do you enjoy the most and which one do you want to skip the most? Why? And please also give constructive suggestion to the style and the content of the homework assignments. Thanks! (10 points) --



※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 61.231.38.225
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/NTU-Exam/M.1421826852.A.FC3.html
1F:推 rod24574575 : 已收资讯系! 01/21 16:00
2F:→ c081215 : 对了,Table 1跟Table 2那张收回去了,基本上就是 01/21 16:01
3F:→ c081215 : 两个表格让你填每个iteration之後找到的最短路径 01/21 16:02
※ 编辑: c081215 (61.231.38.225), 01/21/2015 16:04:03







like.gif 您可能会有兴趣的文章
icon.png[问题/行为] 猫晚上进房间会不会有憋尿问题
icon.pngRe: [闲聊] 选了错误的女孩成为魔法少女 XDDDDDDDDDD
icon.png[正妹] 瑞典 一张
icon.png[心得] EMS高领长版毛衣.墨小楼MC1002
icon.png[分享] 丹龙隔热纸GE55+33+22
icon.png[问题] 清洗洗衣机
icon.png[寻物] 窗台下的空间
icon.png[闲聊] 双极の女神1 木魔爵
icon.png[售车] 新竹 1997 march 1297cc 白色 四门
icon.png[讨论] 能从照片感受到摄影者心情吗
icon.png[狂贺] 贺贺贺贺 贺!岛村卯月!总选举NO.1
icon.png[难过] 羡慕白皮肤的女生
icon.png阅读文章
icon.png[黑特]
icon.png[问题] SBK S1安装於安全帽位置
icon.png[分享] 旧woo100绝版开箱!!
icon.pngRe: [无言] 关於小包卫生纸
icon.png[开箱] E5-2683V3 RX480Strix 快睿C1 简单测试
icon.png[心得] 苍の海贼龙 地狱 执行者16PT
icon.png[售车] 1999年Virage iO 1.8EXi
icon.png[心得] 挑战33 LV10 狮子座pt solo
icon.png[闲聊] 手把手教你不被桶之新手主购教学
icon.png[分享] Civic Type R 量产版官方照无预警流出
icon.png[售车] Golf 4 2.0 银色 自排
icon.png[出售] Graco提篮汽座(有底座)2000元诚可议
icon.png[问题] 请问补牙材质掉了还能再补吗?(台中半年内
icon.png[问题] 44th 单曲 生写竟然都给重复的啊啊!
icon.png[心得] 华南红卡/icash 核卡
icon.png[问题] 拔牙矫正这样正常吗
icon.png[赠送] 老莫高业 初业 102年版
icon.png[情报] 三大行动支付 本季掀战火
icon.png[宝宝] 博客来Amos水蜡笔5/1特价五折
icon.pngRe: [心得] 新鲜人一些面试分享
icon.png[心得] 苍の海贼龙 地狱 麒麟25PT
icon.pngRe: [闲聊] (君の名は。雷慎入) 君名二创漫画翻译
icon.pngRe: [闲聊] OGN中场影片:失踪人口局 (英文字幕)
icon.png[问题] 台湾大哥大4G讯号差
icon.png[出售] [全国]全新千寻侘草LED灯, 水草

请输入看板名称,例如:Boy-Girl站内搜寻

TOP