Re: [問題] ternary tree
※ 引述《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
推
04/22 08:40, , 1F
04/22 08:40, 1F
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 2 之 2 篇):