heap sort

Then the heap is essentially a complete binary tree that satisfies the following properties: Note: ① Any subtree in the heap is also a heap. ②The heap discussed above is actually a Binary Heap, and a k-heap can be defined similarly.
Note: ① Any subtree in the heap is also a heap. ②The heap discussed above is actually a Binary Heap, and a k-heap can be defined similarly.
Note: ① Any subtree in the heap is also a heap. ②The heap discussed above is actually a Binary Heap, and a k-heap can be defined similarly.
Define the height of the heap as the height of the tree root. We will see that the running time of some basic operations on the heap structure is at best O(lgn) proportional to the height of the tree.
Define the height of the heap as the height of the tree root. We will see that the running time of some basic operations on the heap structure is at best O(lgn) proportional to the height of the tree.
The key not greater than (or less than) the key of its left and right children (if any) nodes.

 

 

Then the heap is essentially a complete binary tree that satisfies the following properties:
Note: ① Any subtree in the heap is also a heap. Note: ① Any subtree in the heap is also a heap.
The key not greater than (or less than) the key of its left and right children (if any) nodes.

 

 

Then the heap is essentially a complete binary tree that satisfies the following properties: ② The heap discussed above is actually a Binary Heap, and a k-heap can be defined similarly.
The key not greater than (or less than) the key of its left and right children (if any) nodes.

 

Then the heap is essentially a complete binary tree that satisfies the following properties:
The key not greater than (or less than) the key of its left and right children (if any) nodes.

 

 

The heap is divided into a large root heap and a small root heap, which is a complete binary tree. The requirement of the big root heap is that the value of each node is not greater than the value of its parent node, that is, A[PARENT[i]] >= A[i]. In the non-descending sorting of the array, the big root heap needs to be used, because according to the requirements of the big root heap, the largest value must be at the top of the heap.

 

The n keyword sequences Kl, K2, ..., Kn are called (Heap) if and only if the sequence satisfies the following properties (referred to as heap properties):
(1) ki<=k(2i) and ki<=k(2i+1) (1≤i≤n/2), of course, this is a small root heap, and the large root heap is replaced by >= number (2)ki >=k(2i) and ki>=k(2i+1) (1≤i≤n/2). //k(i) is equivalent to the non- leaf node of the binary tree , K(2i) is the left child node, k(2i+1) is the right child node
 
Big root heap and small root heap: The key of the root node (also known as the top of the heap ) is the smallest of all the node keys in the heap. The heap is called the small root heap, also known as the smallest heap . The key of the root node (also known as the top of the heap ) is the largest of all the node keys in the heap, which is called the big root heap, also known as the largest heap. Note: ① Any subtree in the heap is also a heap. ②The heap discussed above is actually a Binary Heap, and a k-heap can be defined similarly.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324509661&siteId=291194637