您的位置:首页 > 其它

算法导论(CLRS, 2nd) 个人答案 Ch6.1

2011-02-10 01:08 190 查看
6.1 - 1:

Define n to be the number of elements in a heap of height h, then:



6.1-2:



6.1-3:

For any of the sub-tree of one max-heap, it maintains the basic heap property, i.e., A[parent(i)] >= A[i]. and the root of one sub-tree is the ancestor of all its nodes, therefore, the root is the largest by recurrence relation.

6.1-4:

The smallest element would be at the leaf of the heap, since its parent is larger that that heap.

6.1-5:

It's not. Example of a heap which is also a sorted array: 1, 2,3, 4,5,6,7

While Example which a heap is not: 1, 2,3, 6,5,4,7

6.1-6:



6.1-7:

(Proof by Mathematical Induction, it's also possible done by reasoning):

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: