您的位置:首页 > 其它

Heapsort 6.1-1

2008-11-01 20:46 239 查看
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).   
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  numbers tree path