Heap sorting and big data application of heap
/ / this exercise is about heap sorting and big data application of heap.
/ / the time complexity of heap sorting is O (n)
/ / the big data application of heap should select small heap for processing.
/ / but the speed slows down obviously when the data exceeds 1000000, which may be slow when building a small heap. "is there a better way?
# include
# include
# include
Using namespace std
/ /.... The following is the sort of heap..
Void AdjustDownGreater (vector& hmoment sizewaret size) / / build a large heap
{
If (size = 0; parent--) / / experience: you can write the inner loop before the outer loop
{
While (parent