# G-Fact 11

Following relationship holds in any n-ary tree in which every node has either 0 or n children.

L = (n-1)*I + 1

Where L is the number of leaf nodes and I is the number of internal nodes.

Proof:

The tree is n-ary tree. Assume it has T total nodes, which is sum of internal nodes (I) and leaf nodes (L). A tree with T total nodes will have (T – 1) edges or branches.

In other words, since the tree is n-ary tree, each internal node will have n branches contributing total of n*I internal branches. Therefore we have the following relations from the above explanations,

n*I = T – 1

L + I = T

From the above two equations, it is easy to prove that L = (n – 1) * I + 1.

Thanks to venki for providing the proof.

Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.