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

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):

转载于:https://www.cnblogs.com/flyfy1/archive/2011/02/10/1950480.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值