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/m.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燈, 水草

請輸入看板名稱,例如:Gossiping站內搜尋

TOP