看板 Grad-ProbAsk 關於我們 聯絡資訊
1. What is the complexity of inorder traversal of binary tree ? a. O(n) b. O(n^2) c. O(logn) d. O(nlogn) 2. Which of the algorithm has stack property(LIFO)? a. Breath first search b. depth first search c. preorder of tree traversal d. none of the above 題目可能有點出入,不過想問一下這兩題的答案? 感謝!! -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 219.85.159.52
tom21tom21:1.a 2.b 我猜得啊 03/06 16:12
dendrobium:1. a 2. c 03/06 16:13
lightergogo:1a. 2.bc 政大有出多選 = = 03/06 16:19
EntHeEnd:請問2是為什麼 ? 03/06 16:21
stevenwin:2是多選題喔QQ 03/06 16:23
EntHeEnd:2我"覺得"只有b也... postorder比較像stack 03/06 16:25
crazyjoe:2只有B吧XD 03/06 16:27
lightergogo:preorder inorder postorder DFS 都是stack的應用 03/06 16:28
lightergogo:這是洪兔講義寫的說= = 03/06 16:29
zkdzvy22:lightergogo正解 只是做輸出的位置不同而已 03/06 16:29
EntHeEnd:stack的應用 不代表有stack property吧...(LIFO) 03/06 16:29
tracy8901:如果多選的話會說Algorithms XD 03/06 16:30
lightergogo:他也沒說是單選XD 03/06 16:31
EntHeEnd:他是問性質 不是問應用吧... ? 03/06 16:31
bernachom:他說which of 沒加is@@? 03/06 16:32
EntHeEnd:真的要說的話 他用has 不是用have 03/06 16:33
lightergogo:有人知道雜湊搜尋的 worst case是多少嗎? 03/06 16:36
zkdzvy22:如果單純就輸出來看的話preorder確實沒有對啦XD 03/06 16:37
※ 編輯: stevenwin 來自: 219.85.159.52 (03/06 16:46)
EntHeEnd:有沒有人可以說明一下 因為還是覺得怪怪的... 03/06 16:44
dendrobium:雜湊搜尋的 worst case是 O(n) 03/06 16:48
assassin88:第一題竟然是n喔..為何不是nlogn?? 03/06 17:10
EntHeEnd:簡單說 要traverse過n個element 就是O(n) 03/06 17:19
ie925155:最多就是經過全部的點阿當然會被 big-O bound 住 03/06 17:52
※ 編輯: stevenwin 來自: 219.85.159.52 (03/06 18:12)
sa074463:第二題完全要看教授要給什麼答案了...今天寫的時候也考慮 03/06 18:35
sa074463:很久 03/06 18:35
chencccc:答案是d.none of the above 03/06 18:42
chencccc:前年碩班考題 同位老師出的 題目一模一樣 是D 03/06 19:00
assassin88:莫非關鍵在於algorithm..@@ 03/06 19:02
sa074463:為什麼是d呢? 可以解釋一下嗎@@? 03/06 19:04