Heap sort learning

The heap is a complete binary tree, and the node value of the largest heap is greater than the left and right child nodes. In this way, the root node is the largest node
. It is very convenient in the application of maximum value.
Because it is a complete binary tree, the heap structure can be clearly mapped to the array for storage.
When constructing the heap, save the data at the end of the array, and then adjust the structure.
Binary sorting tree to find the maximum value requires a search operation. When
deleting, in order to ensure the stability of the structure, fill the last node to the empty position and then adjust the position

After understanding the structure of the heap, it is easier to understand the heap sorting. Take the big root heap as an example. The root node is the maximum value. Exchange the root node and the last node before adjusting the data. This adjustment is carried out layer by layer. , The time complexity is lgN,

Reference
https://www.cnblogs.com/lsf2015/p/4735257.html

I used the app #CSDN# to find a blog with technical content. Friends ask for the same to go to "Heap Sorting Algorithm (illustrated detailed process)", let's watch https://blog.csdn.net/u010452388/article/ details/81283998

Guess you like

Origin blog.csdn.net/aaajj/article/details/110397855