算法导论(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):
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):
相关文章推荐
- 算法导论(CLRS, 2nd) 个人答案 Ch2 end of chapter
- 算法导论(CLRS, 2nd) 个人答案 Ch12.1
- 算法导论(CLRS, 2nd) 个人答案 Ch5.1
- 算法导论(CLRS, 2nd) 个人答案 Ch34.1
- 算法导论(CLRS, 2nd) 个人答案 Ch1
- 算法导论(CLRS, 2nd) 个人答案 Ch2.1
- 算法导论(CLRS, 2nd) 个人答案 Ch11.1
- 算法导论(CLRS, 2nd) 个人答案 Ch2.2
- 算法导论(CLRS, 2nd) 个人答案 3.1
- 算法导论(CLRS, 2nd) 个人答案 Ch2.3
- 算法导论(CLRS, 2nd) 个人答案 3.2
- 算法导论(CLRS 2ed) 个人答案 11.2
- 算法导论 个人答案 12.2 (未完)
- 算法导论(CLRS)答案
- 算法导论(CLRS)答案
- 算法导论 CLRS 27.2-5 解答
- 算法导论第四章习题答案(第三版) Introduction to Algorithm
- 算法导论CLRS 2.1 插入排序
- 算法导论CLRS 9.1 最大值和最小值
- 算法导论第二章原创部分答案(更新中)