Problem:
What are the minimum and maximum numbers of elements in a heap of height h?
My answer:
The height of a node in a heap is the number of edges of the longest simple path from the node downward to a leaf, so the height of a heap is the height of its root.
When a heap of height h is a full binary tree, it has the maximum number of elements, which is 2^(h+1)-1.
And the minimum number of a heap with height h is 2^(h).
Heapsort 6.1-1
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章
introduction to algorithm-chapter2
liucheng17
2020-02-24 17:14:17
Introduction to Algorithm Chapter 02 思考題
DickensTone
2019-01-12 15:25:57
Introduction to Algorithm 第二章第三節
DickensTone
2018-11-07 00:31:19
Introduction to Algorithm 第二章第一節
DickensTone
2018-09-02 05:35:44
Introduction to Algorithm 第二章第二節
DickensTone
2018-09-02 05:35:43
Introduction to Algorithm( chapter 9 and 10)
liucheng17
2018-08-23 04:22:42
Introduction to Algorithm ( chapter 15: Dynamic Programming)
liucheng17
2018-08-23 04:22:42
Introduction to Algorithm(chapter 5)
liucheng17
2018-08-23 04:22:42
Introduction to Algorithm(chapter 8)
liucheng17
2018-08-23 04:22:42
Introduction to Algorithm(chapter 6)
liucheng17
2018-08-23 04:22:42
Introduction to Algorithm(chapter 14)
liucheng17
2018-08-23 04:22:42
Introduction to Algorithm(chapter 7)
liucheng17
2018-08-23 04:22:31
Introduction to Algorithm(chapter 12)
liucheng17
2018-08-23 04:22:31
Introduction to algorithm(chapter 13)
liucheng17
2018-08-23 04:22:30