Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

Heap sorting and big data application of heap

Shulou Source: shulou.com Published: 2022-06-03 03:41:03 10月04日 Update

/ / 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

Tags: Data application sorting obvious maximum minimum number method selection speed loop complexity inner layer cause parameter complexity outer layer large pile that is array Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info Redmi Huawei MariaDB macOS