Number of binary trees formed with 5 nodes area)32b)36c)120d)42Correc...
Possible number of binary trees formed when n number of nodes are given is 2nCn / n+1 so in this case the number of nodes are 5 so
Number of binary trees possible are = 10C5 / 6 = 10!/ 5! * 5! * 6 → 42
Hence option D is the correct answer
Total number of different Binary tree of size
5 : 14 + 5 + 4 + 5 + 14 = 42
View all questions of this test
Number of binary trees formed with 5 nodes area)32b)36c)120d)42Correc...
To determine the number of binary trees that can be formed with 5 nodes, we can use the concept of Catalan numbers. Catalan numbers are a sequence of natural numbers that occur in various counting problems, often involving recursive structures.
The formula to calculate the nth Catalan number is given by:
C(n) = (2n)! / ((n+1)! * n!)
where n is the number of nodes in the binary tree.
Explanation:
- The total number of nodes in a binary tree is given by the sum of the number of nodes in its left subtree and right subtree, plus 1 for the root node.
- Let's consider the left subtree to have l nodes and the right subtree to have r nodes. We have the following equation: l + r + 1 = n
- We can choose any number of nodes for the left subtree, ranging from 0 to n-1. For each choice of l nodes, the number of nodes in the right subtree will be n-1-l.
- The number of binary trees with l nodes in the left subtree and n-1-l nodes in the right subtree can be calculated by multiplying the number of binary trees with l nodes in the left subtree by the number of binary trees with n-1-l nodes in the right subtree.
- Therefore, the total number of binary trees with n nodes is the sum of the number of binary trees for each possible value of l, ranging from 0 to n-1.
- Using the formula for Catalan numbers, we can calculate C(n) by substituting the value of n into the formula.
In this case, we need to calculate C(5):
C(5) = (2*5)! / ((5+1)! * 5!)
= 10! / (6! * 5!)
= (10 * 9 * 8 * 7) / (4 * 3 * 2 * 1)
= 42
Therefore, the number of binary trees that can be formed with 5 nodes is 42.