A complete tree is a tree in which each node has children or no children. Let be the number of internal nodes and be the number of leaves in a complete tree. If and , what is the value of ?
View worked solution
Answer: C
To find the value of , we can establish a relationship between the number of internal nodes (), the number of leaves (), and the degree of the tree ().
Let be the total number of nodes in the -ary tree. By definition, we have:
In a complete -ary tree, every internal node has exactly children, and the root is the only node that is not a child of any node. Therefore, the total number of nodes can also be expressed in terms of the children of internal nodes:
Equating the two expressions for :
Rearranging the equation to solve for :
Given that and , we substitute these values into the equation:
Thus, the value of is , which corresponds to option C.
Free practice · Your answers on this page are not saved.
