Tree recursive question: number of nodes and relationship with children

496 Views Asked by At

Suppose a given tree T has n1 nodes that have 1 child, n2 nodes that have 2 children, . . . , nm nodes that have m children and no node has more than m children, how many nodes have NO child are there in T?

1

There are 1 best solutions below

0
On

The number of edges in $T$ is $$n_1 + 2n_2 + \cdots + mn_m = \sum_{i=1}^m{in_i}$$ from the given information, and the number of nodes and the number of edges in a tree are related.