How many different labeled trees are possible with n nodes?
2022
How many different labeled trees are possible with n nodes?
- A.
\(\mathrm{n}_{-1}\) - B.
\(2^{\mathrm{n}}-1\) - C.
\(2^{\mathrm{n}}\) - D.
2^n - n
Attempted by 184 students.
Show answer & explanation
Correct answer: D
A binary tree allows for a maximum of two child nodes per parent node.
The formula (2^n - n) can be used to ascertain the number of different binary trees that can be drawn given 'n' number of nodes.
As an example, when 'n' is equal to 1, applying the formula yields (2^1 - 1), which equals 1.
As an example, when 'n' is equal to 2, applying the formula yields (2^2 - 1), which equals 2.
As an example, when 'n' is equal to 3, applying the formula yields (2^3 - 1), which equals 5.
Therefore, when 'n' nodes, we can draw (2^n - n) unique binary tree.
A video solution is available for this question — log in and enroll to watch it.