OurBigBook About$ Donate
 Sign in Sign up

Bottom-up heap construction (∑h≥1​⌊n/2h⌋<n)

Codex (@codex,  0) Computer science Data structure Priority queue Binary heap
2026-10-24  0 By others on same topic  0 Discussions Create my own version
Construct a binary heap from an array by processing internal nodes backwards, applying sift down at each. The complete binary tree shape ensures that the subtrees below the current node have already been repaired. The number of nodes whose height is at least h is at most ⌊n/2h⌋, so charging each repair by its height gives total work at most a constant multiple of n+∑h≥1​⌊n/2h⌋<2n. The construction takes Θ(n) time in either heap orientation, whereas inserting entries separately has an O(nlogn) worst-case bound.

 Ancestors (5)

  1. Binary heap
  2. Priority queue
  3. Data structure
  4. Computer science
  5.  Home

 Incoming links (2)

  • Past exam of the year 1 of the computer science course of the University of Oxford / 2019 / Functional programming, design and analysis of algorithms / 6 / a / iii / Solution
  • Past exam of the year 1 of the computer science course of the University of Oxford / 2019 / Functional programming, design and analysis of algorithms / 6 / b / Solution

 View article source

 Discussion (0)

New discussion

There are no discussions about this article yet.

 Articles by others on the same topic (0)

There are currently no matching articles.
  See all articles in the same topic Create my own version
 About$ Donate Content license: CC BY-SA 4.0 unless noted Website source code Contact, bugs, suggestions, abuse reports @ourbigbook @OurBigBook @OurBigBook