A tree is such that
- All internal nodes have either or children
- All paths from root to the leaves have the same length
The number of internal nodes of a tree having leaves could be
View worked solution
Answer: A;D
Let be the height of the tree (where the root is at level and the leaves are at level ). Since all leaves are at the same depth, we can analyze the tree structure based on :
- Case 1:
Let the root have children, where . Each of these children is an internal node at level 1, which must have either or leaf children.- If , the maximum number of leaves is .
- If , the only way to get leaves is if each of the internal nodes has exactly children ().
- Case 2:
Let be the number of internal nodes at level 2. These nodes must produce leaves, so: where and are the number of level 2 nodes with and children respectively, and .- If , then . However, we cannot form nodes at level 2 from level 1 because the minimum children from a root of degree is .
- If , then . We can form nodes at level 2 if the root has children, and each of those has children ().
- Case 3:
The minimum number of leaves for height is , so no solutions exist here.
Thus, the possible number of internal nodes is or .
Free practice · Your answers on this page are not saved.
