A complete -ary tree is one in which every node has or sons. If is the number of internal nodes of a complete -ary tree, the number of leaves in it is given by
View worked solution
Answer: A
To find the number of leaves in a complete -ary tree with internal nodes, we can use the relationship between the total number of nodes, internal nodes, and edges.
Method 1: Using Node and Edge Relations
- Let be the total number of nodes in the tree. Since every node is either an internal node or a leaf, we have:
- In a complete -ary tree, every internal node has exactly children. Therefore, the total number of children in the tree is .
- Since every node in the tree except the root is a child of some node, the total number of nodes is also given by:
Equating the two expressions for :
Solving for :
Method 2: Verification with an Example
Let (a complete binary tree) and (only the root is an internal node, having children).
- The number of leaves is .
- Substituting and into the options:
- Option A: (Correct)
- Option B:
- Option C:
- Option D:
Thus, the correct option is A.
Free practice · Your answers on this page are not saved.
