b04902xxx 板


LINE

※ [本文轉錄自 NTU-Exam 看板 #1Kkwa6R8 ] 作者: irritum (働いたら 負け) 看板: NTU-Exam 標題: [試題] 103上 林智仁 自動機與形式語言 期末考+解答 時間: Sun Jan 18 20:37:22 2015 課程名稱︰ 自動機與形式語言 課程性質︰ 必修 課程教師︰ 林智仁 開課學院: 電機資訊 開課系所︰ 資訊工程 考試日期(年月日)︰ 2015/1/6 考試時限(分鐘): 試題 : ‧ Please give details of your answer. A direct answer without explanation is not counted. ‧ Your answers must be in English. ‧ Please carefully read problem statements. ‧ During the exam you are not allowed to borrow other's class notes. ‧ Try to work on easier questions first. Problem 1 (10 pts) If we would like to prove f(n) ≠ O(g(n)), we need to show the opposite statement of the definition of f(n) = O(g(n)). What is this oppsite statement ? ∀ c > 0, N ∈ N (自然數), ∃n ≧ N such that f(n) > cg(n). Problem 2 (25 pts) Consider the following two functions ╭ f(n) = │ n^3, if n is odd │ n^2, if n is even ╰ ╭ g(n) = │ n^3, if n is prime │ n^2, if n is composite ╰ Which of the following statements are true ? (a) f = O(n^2) (b) f = O(n^3) (c) g = O(n^2) (d) g = O(n^3) (e) f = O(g) (f) g = O(f) (g) n^2 = O(f) (h) n^3 = O(f) (i) n^2 = O(g) (j) n^3 = O(g) You must prove the result of each sub-problem. If you think the statement is false, you should prove the definition that you wrote for problem 1. Statements (b),(d),(f),(g),(i) are true. (a) For any c > 0, N ∈ N, we can let n = an odd number larger than c and N. Then f(n) = n^3 > cn^2 → f ≠ O(n^2) (b) Let c = 1 and N = 1 cn^3 > n^2 ∀n ≧ N → cn^3 > f(n) ∀n ≧ N → f = O(n^3) (c) For any c > 0, N ∈ N, we can let n = a prime number larger than c and N. Then g(n) = n^3 > cn^2 → g ≠ O(n^2) (d) Let c = 1 and N = 1 cn^3 > n^2 ∀n ≧ N → cn^3 > g(n) ∀n ≧ N → g = O(n^3) (e) For any c > 0, N ∈ N, we can let n = an odd and composite number larger than c and N. Then f(n) = n^3 > cg(n) = cn^2 → f ≠ O(g) (f) Let c = 1 and N = 3 Because all of the prime numbers excepts 2 are odd, cf(n) = cn^3 ≧ g(n) = n^3 , when n is prime and n≠ 2 and cf(n) = │ cn^3 │ ≧ g(n) = n^2, when n is composite. │ cn^2 Therefore, cf(n) ≧ g(n) ∀n ≧ N → g = O(f) (g) Let c = 1 and N = 1 cn^3 ≧ n^2 ∀n ≧ N → cf(n) ≧ n^2 ∀n ≧ N → n^2 = O(f) (h) For any c > 0, N ∈ N, we can let n = an even number larger than c and N. Then n^3 > cf(n) = cn^2 → n^3 ≠ O(f) (i) Let c = 1 and N = 1 cn^3 > cf(n) = cn^2 ∀n ≧ N → cg(n) ≧ n^2 ∀n ≧ N → n^2 = O(g) (j) For any c > 0, N ∈ N, we can let n = a composite number larger than c and N Then n^3 > cg(n) = cn^2 → n^3 ≠ O(g) Problem 3 (20 pts) f(n) O(f(n)) Assume g(n) ≧ n. Consider O(2 ) and 2 . Do we have f(n) g(n) = O(2 ) O(f(n)) → g(n) = 2 or O(f(n)) g(n) = 2 f(n) → g(n)= O(2 ) (a) We will show that g(n) = O(2^f(n)) → g(n) = 2^O(f(n)) is true Proof: Since g(n) ≧ n and g(n) = O(2^f(n)), ∃c1 > 0, N1 ≧ 1, st. c ≦ g(n) ≦ c1 * 2^f(n), ∀n ≧ N1, (1) To prove that g(n) = 2^O(f(n)), we must prove that g(n) ≦ c1 * 2^f(n) ≦ 2^(c2*f(n)), ∀n ≧N2 (2) is true for some c2 > 0, N2 ≧ N1 Which means we should prove that ∃c2 > 1, N2 ≧ N1 s.t. ∀n ≧ N2. log(c1) + f(n) ≦c2 * f(n) → f(n) ≧ log(c1)/(c2-1) According to (1), we have log n ≦ log(c1) + f(n) → f(n) ≧ log(n) - log(c1) Therefore, we should prove that ∃c2 > 1, N2 ≧ N1 s.t. log(n) - log(c1) ≧ log(c1)/(c2-1) → log(n) ≧ (c2/(c2-c1))*log(c1) This is always true when n becomes large. So given c1, N1, ∃c2 = 2, N2 = max{ N1, 4c1 }, such that (2) is true. Therefore, g(n) = 2^O(f(n)) (b) We will show that g(n) = 2^O(f(n)) → g(n) = O(2^f(n)) is not true. Proof: Let g(n) = 2^(2n), f(n) = n. Since g(n) ≦ 2^(2*f(n)) for n ≧ 1, we have g(n) = 2^O(f(n)). Assume g(n) = O(2^f(n)). There are c > 0, N ≧ 1, such that ∀n ≧ N, 2^(2n) ≦ c * 2^n, → 2^(2n) ≦ c, ∀n ≧ N. However, we can't find a constant c to satisfy 2^n ≦ c, ∀n ≧ N, because the left side of the inequality goes to infinity when n → ∞. Therefore there is a contradiction. Problem 4 (20 pts) Consider f(n) = log(1 + ε^n) g(n) = n h(n) = n^2 Which of the following statements are true ? For small-o, you can directly calculate the limit without getting into the definition of limit. (a) f(n) = O(g(n)) (b) f(n) = o(g(n)) (c) f(n) = O(h(n)) (d) f(n) = o(h(n)) Statement (a),(c),(d) are true. (a) ∵ f(n) = log(1+ε^n) < log (2*ε^n) = log(2)+n ≦ 2*n, for n ≧ 1 ∴ ∃c = 2, N = 1, s.t. ∀n ≧ N f(n) ≦ cn ∴ f(n) = O(n) = O(g(n)) (b) According to L'Hospital Rule, f(n) f'(n) e^n/(1+e^n) 1 lim ─── = lim ─── = lim ────── = lim (1 - ───) = 1 n→∞ g(n) n→∞ g'(n) n→∞ 1 n→∞ 1+e^n Therefore, f(n) ≠ o(g(n)) (c) Since n^2 ≧ n, from sub-problem (a), ∃c = 2, N = 1 such that f(n) ≦ cn ≦ cn^2, ∀n ≧ N. Therefore, f(n) = O(h(n)) (d) According to L'Hospital Rule, f(n) e^n/(1+e^n) lim ─── = lim ────── = 0 n→∞ h(n) n→∞ 2n Therefore, f(n) = o(h(n)) Problem 5 (5 pts) Is the following language Turing recognizable ? _ A_TM = {〈M,w〉│〈M,w〉∈/ A_TM }, (ps. ∈/ : 不屬於(打不出來)) where A_TM = {〈M,w〉│ M is a TM and accepts w} It is not Turing recognizable. We know that A_TM is Turing recognizable but undecidable. (Throrem 4.11) _ Assume that A_TM is Turing recognizable. Then A_TM is both co-Turing recognizable and Turing recognizable. By Theorem 4.22 in the textbook, A_TM is decidable. However, we have proved that A_TM is not decidable, so there is a contradiction. Problem 6 (20 pts) Consider the following language A = {〈R,S〉│ R and S are regular expression and L(R) ⊆ L (S)} Is it decidable? Yes, it is decidable. We first obseve that L(R) ⊆ L(S) iff ∀w ∈ L(R), w ∈ L(S) __ iff ∀w ∈ L(R), w ∈\ L(S) __ iff L(R) ∩ L(S) = Φ We can construct a DFA C such that __ L(C) = L(R) ∩ L(S) with 1. The conversion of regular expression to an equivalant NFA (procedure in Theorem 1.54). 2. Constructions for proving closure of regular languages under complementation and intersection. 3. Conversion from NFA to DFA. __ We can then use Theorem 4.4 to test if L(C) = L(R) ∩ L(S) is empty. The following TM F decides A: On input〈R, S〉, where R and S are regular expressions. 1. Construct DFA C as described. 2. Run TM T from Theorem 4.4 on input〈C〉. 3. If T accepts, accept. If T rejects, reject. --



※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 111.250.116.228
※ 文章網址: https://webptt.com/m.aspx?n=bbs/NTU-Exam/M.1421584646.A.6C8.html
1F:推 rod24574575 : 已收資訊系! 01/18 22:47



※ 發信站: 批踢踢實業坊(ptt.cc)
※ 轉錄者: w4a2y4 (140.119.121.6), 01/05/2018 16:46:34
2F:→ w4a2y4: 更早以前的 https://goo.gl/xpyQWa 01/05 16:47







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

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

TOP