in Algorithms recategorized by
2,851 views
1 vote
1 vote

The number of nodes in a complete binary tree of height $h$ (with roots at level $0$) is equal to

  1. $2^{0} + 2^{1} + ….. 2^{h}$
  2. $2^{0} + 2^{1} + ….. 2^{h-1}$ 
  3. $2^{0} + 2^{1} + ….. 2^{h+1}$
  4. $2^{1} + ….. 2^{h+1}$
in Algorithms recategorized by
2.9k views

2 Answers

2 votes
2 votes
Best answer

Option A is Ans

Height:--No of edges between root node to lowest descendent node

The total no. Of nodes in complete binary tree is depicted below:--

selected by
2 votes
2 votes

complete binary tree is filled left to right

and we know that maximum number of nodes possible in complete binary tree of height h = $2^{h+1}-1$

here,

option A)  $2^0+2^1+2^2+2^3+......+2^{h-1}+2^h = 1 + 2(\frac{2^h-1}{2-1}) = 1 + 2^{h+1} - 2$

$= 2^{h+1} - 1$

2 Comments

Thanx for d ans though there is no -1 in the option given above. Please can you clarify it?
0
0
that -1 comes after using GP fomula
0
0

Related questions