NTU-Exam 板


LINE

課程名稱︰資料結構與演算法下 課程性質︰系必修 課程教師︰蔡欣穆 開課學院:電資學院 開課系所︰系訊系 考試日期(年月日)︰2011/4/22 考試時限(分鐘):180min 是否需發放獎勵金:是的,感謝 (如未明確表示,則不予發放) 試題 : Prob1.In each of the 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. (20 points. For each question, 1 point for the true/false answer and 3 points for the explanations.) 1.n㏒n is polynomially larger than n. 2.n^(1+10^(-100)) is polynomially larger than n㏒n. 3.As long as a problem exhitbits optimal substructure, it can be solved by using a greedy algorithm. 4.The solution of T(n)=4T(n/2)+n^2 is T(n)=Θ(n㏒n). 5.As long as a recurrence is of the form T(n)=a(Tn/b)+f(n), it can be solved by using the master method. Prob2."Short answer" questions: (25 points) 1.What is the main job of a Quality Assurance(QA) engineer in a software company?(4 points) 2.Give a formal definition of "uniform random permutation".(4 points) 3.Derive an optimal Huffman code for the frist n Fibonacci numbers, i.e., {C1:1 C2:1 C3:2 C4:3 C5:5 C6:8 C7:13 C8:21 ... Cn:F(n)}. in other words, show the general form of the codeword for the i-th charater Ci(with F(i) as its frequency). (5 points) 4.Give two reasons for implementing the paper prototype instead of the "real" prototype in a software project. (4 points) 5.How do we roughly estimate the cost of a software product? (4 points) 6.Give two reasons for writing down the specifications of a software project before we start writing codes.(4 points) Prob3.Given a list of n distinct numbers (not sorted), please derive a divide- and-conquer algorithm to return the first k smallest numbers in the list. Your algorithm should have a running time of O(n). Note that you cannot use the number selection algorithm taught in the class for k times, as the running time will be Θ(kn)=O(n^2). Sorting does not work either as it will take O(n㏒n). In addition to the algorithm, please write down the recurrence representing the running time, solve the recurrence, and prove your solution by induction.(15 points, 7 points for the algorithm, 3 points for the recurrence, and 5 points for the proof) Prob4.Use the recursion-tree method to derive an asymptotic tight upper bound for T(n)=T(n/2)+T(n/4)+T(n/8)+n. You can assume that T(n) is a constant when n is sufficiently small. Prove that your bound is correct by induction.(10 points, 5 points for the recursion-tree and 5 points for proof) Prob5.For bit strings X=X1...Xm, Y=Y1...Yn and Z=Z1...Zm+n, we say that Z is an interleaving of X and Y if it can be obtained by interleaving the bits in X and Y in a way that maintains the left-to-right order of the bits in X and Y. For example if X=101 and Y=01 then X1X2Y1X3Y2=10011 is an interleaving of X and Y, whereas 11010 is not.(15 points) 1.Please come up with the definition of the subproblem. Use your definition and prove that this problem has optimal substructure. (5 points) 2.Give the most efficient algorithm you can to determine if Z is an interleaving of X and Y. (7 points) 3.Analyze the time complexity of your algoithm as a function m=|X| and n=|Y| Prob6.Consider the problem of making change for n dollars using the fewest number of coins. Assume that each coin's value is an integer. The same coin can be used for any number of times in the change. (25 points) 1.Prove that the problem exhibits optimal substructure. (5 points) 2.Assume the following set of coins is available to you:1,5,10,50. Prove that under this codition, the problem ahs the greedy property. (5 points) 3.Describe a greedy algorithm to solve the problem with the coin set in 2. 4.Give a set of coins for which the greedy algorithm in 3 does not yield an optimal solution. Your set should nclude a one-dollar coin so that there is a solution to every value of n. Explain the intuition behind your choice of coins in the set. (3 points) 5.Describe a dynamic programming algorithm which solve the problem with any coin set with k different coins, assuming that one of them is a one-dollar coin. (7 points) Prob7.This problem examines three algorithms for searching for a value x in an unsorted array A consisting of n elements(x appears in A for k times, k≧0): (20 points) ˙Algorithm α: We pick a random index i into A. If A[i]=x, then we terminate; otherwise, we continue the search by picking a new random index into A. We continue picking random indices into A until we find an index j such that A[j]=x or until we have checked every element of A. Note that we pick from the whole set of indices each time, so that we may examine a give element more than once. ˙Algorithm β: The algorithm searches A for x in order, considering A[1],A[2], ...,A[n] until either it finds A[i]=x or it reaches the end of the array. Assume that all possible permutations of the input array are equally likely. ˙Algorithm γ:We uniformly and randomly permute the input array A and then run Algorithm β 1.For each algorithm, derive the expected running time when (a)k=0 (b)k≧1. (18 points, 3 points for each answer) 2.Which algorithm would you use? Please explain your answer. (2 points) Prob8.This semestere we made lots of changes in the course compared to last semester (homeworks, programming assignments, course content), and we are curious about how you feel about the current form of the course. If you have the power of changing 3 things in the course, what would these 3 things be and how would you change them? Your feedbacks are very important to the teaching team; we thank you for your valuable opinion.:) (10 points) --



※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 123.193.6.232
1F:→ andy74139 :已收錄至資訊系!! 04/25 21:26







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