作者ixjnpns (F‧R‧I‧E‧N‧D‧S)
看板Grad-ProbAsk
標題Re: [問題] 資結-是非題..
時間Sun Apr 5 09:12:16 2009
※ 引述《bernachom (Terry)》之銘言:
: 1. For a complete binary tre represented in memory as an array,if there is
: a node at index 4i+3 it must be a child of a child (grandchild) of the
: node at i.
i
/ \
2i 2i+1
/ \ / \
4i 4i+1 4i+2
4i+3
: 2. Searching for a key in a heap takes worst-case time O(n).
事實上任何key值的search 最差就是O(n)了 -> 將所有key值都測試過
: 解答寫: 1.T 2.T
: 第一題我不太清楚...
: 第二題最差的case 不是應該為nlogn才是嗎?
: 謝謝
--
做一點自己能做的事
http://www.wretch.cc/blog/showyincs/68854
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 122.117.20.95
※ 編輯: ixjnpns 來自: 122.117.20.95 (04/05 09:14)
1F:推 bernachom:謝謝您,我知道了 04/05 14:09