作者gensim (...)
看板Grad-ProbAsk
标题Re: [问题] ternary tree
时间Tue Apr 21 23:16:42 2009
※ 引述《missluk (没经验不懂事)》之铭言:
: 请问这题该怎麽做呢~@@
: Ternary tree is a tree in which each interior node can have at most 3
: children. Ternary heap is a full ternary tree with some of the rightmost
: leaves in the lowest level removed. Here, we implement priority queue by
: ternary heap tree (with array implementation) in which the priority of node v
: isn’t less than the priority of its children. Assume that the index of root
不小於子节点=>Max heap
: is one.
: a) Calculate the indices of three elements which are children of i-th element
3i-1, 3i, 3i+1
: b) What is the index of the element which is a parent of the i-th element
(i+1)/3
: c) Show the ternary heap tree that results after successively inserting
: the integer 10,5,4,6,8,9,1,3,7 into an initially empty ternary heap tree
10 ---level 1
9 7 6 ---level 2
5 8 1 3 4 ---level 3
: d) What is the result of two successive EXTRACT-MAY operation of the tree in (c
: 这题的c和d小题~
删除10--
9
8 7 6
5 4 1 3
删除 9--
8
5 7 6
3 4 1
结束~~
: 麻烦了:)
: 谢谢
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 114.40.24.43
1F:推 missluk:谢谢 04/22 08:40