The height of a tree is the length of the longest root to leaf path in...
Height is defined as path length i.e (height+1) will give number of levels. In a binary tree of height h = 4;
Maximum number of nodes = 2^(h+1)-1
= 31
Minimum number of nodes = 5
Therefore (d) is correct answer.
View all questions of this test
The height of a tree is the length of the longest root to leaf path in...
The height of a binary tree is defined as the length of the longest root-to-leaf path. The minimum number of nodes in a binary tree of height 4 can be calculated using the formula 2^(h+1) - 1, where h is the height of the tree.
To find the minimum number of nodes in a binary tree of height 4, we substitute h = 4 into the formula:
2^(4+1) - 1 = 2^5 - 1 = 32 - 1 = 31
So, the minimum number of nodes in a binary tree of height 4 is 31.
To find the maximum number of nodes in a binary tree of height 4, we consider a complete binary tree. In a complete binary tree, all levels except the last level are completely filled, and the last level is filled from left to right.
In a complete binary tree of height h, the maximum number of nodes can be calculated using the formula 2^(h+1) - 1.
Substituting h = 4 into the formula:
2^(4+1) - 1 = 2^5 - 1 = 32 - 1 = 31
So, the maximum number of nodes in a binary tree of height 4 is also 31.
Therefore, the maximum and minimum number of nodes in a binary tree of height 4 is 31 and 31 respectively.
Option D "31 and 5" is the correct answer.