作者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