$2^h-1$ is the inner nodes and also that is construed according to the understood fact. But since nowhere except CLRS mentions heaps to it is in a Nearly finish Binary Tree anywhere it is pointed out as a complete Binary Tree.
You are watching: What are the minimum and maximum number of elements in a heap of height h?
The maximum number of elements have the right to be quickly computed:$$sum_i=0^h 2^i = 2^h+1-1$$
But i cannot get the allude of computing the minimum number of elements:Should the be:$$2^h+1$$ because that $0$ or $2$ youngsters property
Or need to it be:$$2^h$$ for $0$ or $1$ children property
Reference1: https://walkccc.github.io/CLRS/Chap06/6.1/#61-1
Reference2: HeapSort
Thank you.
algorithms binary-trees heaps
re-publishing
cite
enhance this inquiry
monitor
asked Jun 19 "20 in ~ 9:20

Sachin BahukhandiSachin Bahukhandi
23722 silver- badges1111 bronze badges
$endgroup$
add a comment |
2 answer 2
energetic oldest Votes
3
$egingroup$
A heap of elevation $h$ is complete up to the level in ~ depth $h-1$ and also needs to have at least one node ~ above level $h$.
Therefore the minimum total number of nodes have to be at least$sum_i=0^h-1 2^i + 1 = 2^h-1 + 1= 2^h.$, and this tight due to the fact that an heap with $2^h$ nodes has height $h$.
re-superstructure
cite
boost this prize
monitor
reply Jun 19 "20 in ~ 11:32

StevenSteven
19.7k22 yellow badges1818 silver- badges3737 bronze title
$endgroup$
3
include a comment |
1
$egingroup$
I know there"s currently an welcomed answer, yet for those who"ve got the exact same question and also are still a little bit perplexed (as i was), or sth is unclear, clock this crystal clearexplanation till the end.
re-superstructure
point out
improve this price
follow
answered might 12 in ~ 17:44

Aarush AggarwalAarush Aggarwal
2111 gold badge11 silver- badge33 bronze badges
$endgroup$
1
add a comment |
her Answer
Thanks because that contributing response to computer system Science stack Exchange!
Please be certain to answer the question. Provide details and also share her research!But avoid …
Asking because that help, clarification, or responding to various other answers.Making statements based upon opinion; earlier them up with referrals or an individual experience.Use MathJax to style equations. MathJax reference.
To find out more, see our tips on writing an excellent answers.
See more: Can A Remington 870 Express Shoot Slugs ? Can You Shoot Slugs With A Stock 870 Express
Draft saved
Draft discarded
Sign increase or log in in
authorize up making use of Google
authorize up using Facebook
authorize up using Email and Password
submit
Post as a guest
surname
email Required, but never shown
Post as a guest
surname
Required, yet never shown
short article Your prize Discard
By clicking “Post her Answer”, you agree come our terms of service, privacy policy and also cookie plan
Not the price you're feather for? Browse other questions tagged algorithms binary-trees heaps or ask your very own question.
Featured ~ above Meta
Visit chat
related
20
Increase-key and decrease-key in a binary min-heap
1
deserve to minimum or maximum elevation of the binary search tree be constrained by the place of some facets
1
Facts about internal and also external path lengths the binary tree
2
deserve to a heap have no elements?
2
The height of subtree in Heap
1
Is there a surname for this priority queue data structure?
2
Prove number of nodes in heap
0
identify minimum and maximum variety of leaves on a complete tree
0
walk the heap home in the meaning of binary heaps use recursively?
warm Network concerns much more hot questions
inquiry feed
subscribe to RSS
concern feed To subscribe to this RSS feed, copy and paste this URL right into your RSS reader.

computer Science
agency
ridge Exchange Network
site style / logo design © 2021 stack Exchange Inc; user contributions licensed under cc by-sa. Rev2021.11.5.40661
Computer scientific research Stack Exchange works finest with JavaScript enabled

her privacy
By clicking “Accept every cookies”, you agree ridge Exchange deserve to store cookie on your an equipment and disclose information in accordance through our Cookie Policy.