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).
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).
相关文章推荐
- Chapter 6 Heapsort
- 堆排序heapSort java实现
- Introduction to Algorithm - Summary of Chapter 6 - Heapsort
- 堆排序(heapsort)
- bubbleSort, InsertionSort, mergeSort, heapSort实现
- 1098. Insertion or Heap Sort (25)
- Heap & HeapSort (using template)
- 1098 Insertion or Heap Sort
- 【heapSort】
- 堆(算法导论 part1 foundations, chapter 6 heapsort)
- sort_heap后使用push_heap ,pop_heap异常
- 堆排序 (Heap Sort)
- heapsort实现代码
- 堆排序(HeapSort)
- solution Of 1098. Insertion or Heap Sort (25)
- PAT 1098. Insertion or Heap Sort (25)
- PAT研究生入学考试2015.03第三题Insertion or Heap Sort (25) 题解
- 堆排序(HeapSort)
- heapsort的一个简单的例子
- 算法总结系列之一:堆排序(Heap Sort)