Show that in a binary tree, if B is the number of branch points (including the root) and L is the number of leaves, then one has the relation L = 1+B

140 Views Asked by At

We have been discussing trees lately, but have yet to even touch on the topic of a binary tree. I understand what a leaf is, but we didn't have one for the term "branch points" Without being 100% sure of what a branch point is, I didn't want to proceed with the proof.

1

There are 1 best solutions below

0
On

It is true for all trees with only one node (a leaf):

$$L = 1,\ B=0$$

At a branch node $N$, if both of its child subtrees satisfy the equation, $$L_1=1+B_1,\ L_2 = 1+B_2$$ (where the subscripts denote each of the two subtrees), then counting the subtree rooted at $N$, the total number of branch nodes is $$B_1+B_2+1$$ and the total number of leaves is $$\begin{align*} L_1+L_2 &= (1+B_1)+(1+B_2)\\ &= 1+ (B_1+B_2+1) \end{align*}$$

By induction from the leaves to the root, the whole binary tree satisfies the relation $L=1+B$.