Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Heap sorting and big data application of heap

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

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

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report