Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Structure property of heaps: •A complete or nearly complete binary tree. •If the height is h, the number of nodes n is between2h-1and (2h-1) •Complete tree: n = 2h-1 when last level is full. •Nearly complete: All nodes in the last level are on the left. | Chapter 8 - Heaps Binary Heap. Min-heap. Max-heap. Efficient implementation of heap ADT use of array Basic heap algorithms ReheapUp ReheapDown Insert Heap Delete Heap Built Heap d-heaps Heap Applications Select Algorithm Priority Queues Heap sort Advanced implementations of heaps use of pointers Leftist heap Skew heap Binomial queues 1 Binary Heaps DEFINITION A max-heap is a binary tree structure with the following properties The tree is complete or nearly complete. The key value of each node is greater than or equal to the key value DEFINITION A min-heap is a binary tree structure with the following properties The tree is complete or nearly complete. The key value of each node is less than or equal to the key value in each of its descendents. max-heap min-heap 2 Properties of Binary Heaps Structure property of heaps Key value order of heaps