39 39 votes The height of a binary tree is the maximum number of edges in any root to leaf path. The maximum number of nodes in a binary tree of height $h$ is: $2^h -1$ $2^{h-1} -1$ $2^{h+1} -1$ $2^{h+1}$ Data Structures gatecse-2007 data-structures binary-tree easy + – Kathleen 32.7k views answer comment Share Follow Print See all 3 Comments 3 3 Comments reply vupadhayayx86 commented Aug 8, 2018 reply Follow flag If height of tree tree start with 0 then? I think answer depends on whether height start from zero or 1. Correct me if I am wrong 1 1 replyShare FUTURE IITIAN S commented Aug 7, 2025 reply Follow flag If we take a perfect binary tree, all nodes are completely filled — including the last level. In this case, it also satisfies the condition of a Complete Binary Tree (CBT). Let’s assume the height h=2The root node is at height 2: → It has 2^0 = 1 nodeThe next level (height 1) has: → 2^1 = 2 nodesThe last level (height 0) has: → 2^2 = 4 nodesSo the total number of nodes is:2^0+2^1+2^2=1+2+4=7This is a geometric series of the form:Sum=a⋅(r^n - 1)(r - 1)Where:a=1=2^ 0 (first term)r=2 (common ratio)n=h+1 (number of terms from 0 to h)So:Total nodes= 2^(h+1) - 1answer is Option C. 0 0 replyShare chidambareswar23 commented Dec 17, 2025 reply Follow flag For a given binary tree height h: Maximum number of nodes possible in case of Perfect binary tree Minimum number of nodes possible in case of Skewed binary tree Note: take example and check but don't remember the maximum nodes blindly 0 0 replyShare Please log in or register to add a comment.
Best answer 60 60 votes $2^{h+1} - 1$ just try this taking a small complete binary never try to remember these formulae as remembering formulae is an overhead try to take examples in such cases. Correct Answer: $C$ Bhagirathi answered Sep 22, 2014 • edited May 4, 2019 by Naveen Kumar 3 Bhagirathi comment Share Follow See all 5 Comments 5 5 Comments reply Show 2 previous comments PRANAV M commented Oct 18, 2019 reply Follow flag But it didnt even mentioned it is complete binary tree???, 0 0 replyShare Gaganjot _Kaur commented Nov 12, 2019 reply Follow flag @PRANAV M Question is asking about the maximum number of nodes for a given height,so number of nodes will be maximum (i.e. tree is most dense) when it is a full binary tree. Also keep in mind the difference between Full and Complete binary tree, they are not the same. 0 0 replyShare arpit.jha commented Sep 18, 2024 i edited by arpit.jha Sep 18, 2024 reply Follow flag @Gaganjot _Kaur the tree for this is Perfect Binary tree(every level fully filled) as Perfect Binary tree implies Full Binary tree(every node have 0 or 2 children) and not just Full binary tree as Full binary tree do not implies Perfect binary tree . 0 0 replyShare Please log in or register to add a comment.
14 14 votes At maximum tree is given as above So maximum height = 2 (15 - > 10 -> 8) or other all are same height Put h = 2 in option and find number of nodes A- 22 -1 = 3 wrong B- 21-1 = 1 wrong C- 23-1 = 7 correct D- 23 = 8 wrong SO option C is correct option Rishi yadav answered Oct 5, 2017 Rishi yadav comment Share Follow 0 reply Please log in or register to add a comment.
4 4 votes height H=0 ( only root node ) , no of node N=1=20 H=1 , N=21 ... so on total =20 +21+22+.......2H =2H+1-1 Ans is C Gate Ranker18 answered Aug 21, 2017 Gate Ranker18 comment Share Follow 0 reply Please log in or register to add a comment.
3 3 votes =2$^0$+2$^1$+2$^2$+...+2$^h$ this a gp =2$^h$$^+$$^1$-1 Musa answered Jul 7, 2020 Musa comment Share Follow 0 reply Please log in or register to add a comment.
0 0 votes We are required to find the maximum number of nodes. Maximum number of nodes will occur in the case of a Perfect tree. We just need to calculate relation between the height of Perfect tree and its number of nodes. Height zero : one node - > 2^0 Height one : two node -> 2^1 Height two : four nodes -> 2^2 ..... Height h : 2^(h) nodes Now if you some all the nodes at various heights , you will get the total number of nodes. N = 2^0 + 2^1 + 2^2 + 2^3 ...... + 2^h (Sum of a Geometric Progression = first term * (1-ratio^number of terms)/(1-ratio)) => N = 2^(h+1) - 1 Swapnil191 answered Nov 11, 2024 Swapnil191 comment Share Follow 0 reply Please log in or register to add a comment.
0 0 votes We are required to find the maximum number of nodes. Maximum number of nodes will occur in the case of a Perfect tree. We just need to calculate relation between the height of Perfect tree and its number of nodes. Height zero : one node - > 2^0 Height one : two node -> 2^1 Height two : four nodes -> 2^2 ..... Height h : 2^(h) nodes Now if you some all the nodes at various heights , you will get the total number of nodes. N = 2^0 + 2^1 + 2^2 + 2^3 ...... + 2^h (Sum of a Geometric Progression = first term * (1-ratio^number of terms)/(1-ratio)) => N = 2^(h+1) - 1 Swapnil191 answered Nov 11, 2024 Swapnil191 comment Share Follow 0 reply Please log in or register to add a comment.