[理工] [DS]-95台大-資工所

看板Grad-ProbAsk作者 (AI)時間16年前 (2010/01/15 00:11), 編輯推噓2(204)
留言6則, 3人參與, 最新討論串1/1
《資料結構》 洪逸 P.9-74 Which of the following is true about the heap data structure ? n is node num. (a)Deleting the minimum element in a min-heap takes O(logn) time (b)Finding the minimum element in a min-heap takes O(logn) time (c)Inserting a node into a Fin. heap takes O(logn) time (d)Decrease-key operation on a node of a Fib. heap takes O(1) time (e)Finding both the monimum and the maximum elements in a min-max heap takes O(1) time 答案是給(A)(C)(D)(E), 可是我覺得答案有點問題, (B)應該是O(1) (C)應該是O(1) (D)應該是O(logn) 答案是(A)(E)? 請指教..感謝 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 61.57.78.8 ※ 編輯: assassin88 來自: 61.57.78.8 (01/15 00:25)

01/15 01:37, , 1F
c的fin是?fib的話,insert是O(1)沒錯
01/15 01:37, 1F

01/15 01:38, , 2F
decrease key也是O(1),可用Amortize證
01/15 01:38, 2F

01/15 12:00, , 3F
C打錯..是Fib. 沒錯~所以C是錯的?
01/15 12:00, 3F

01/15 12:01, , 4F
請問Amortize證明哪邊有提到??
01/15 12:01, 4F

01/15 12:15, , 5F
(C)in wrost case是O(logn) 大部分case和avg.才是O(1)
01/15 12:15, 5F

01/15 12:16, , 6F
題目沒說是一般情形 所以有可能是worst case
01/15 12:16, 6F
文章代碼(AID): #1BJq8PgR (Grad-ProbAsk)