• recategorized by
5,477 views

3 Answers

Best answer
25 25 votes

Base Case :- When we have just root then, there are no non leaf nodes. So No of leaves $= 1$, No of non leaf nodes is $= 0$. Base case holds.

Induction Hypothesis :- Assume that now for $k$ internal nodes we will have $k+1$ leaves.

Inducting on no of leaves, Now we add $2$ more leaves to this tree. One of $k+1$ leaf will become internal node. So now we will have $k+1$ internal node. No of leafs will be $K+ 1 - 1$ ($1$ leaf just became internal node) $+ 2$(New leafs) . So we proved that for any binary tree, in which every non-leaf node has $2$-descendants, the number of leaves in the tree is one more than the number of non-leaf nodes.

• edited by
9 9 votes
**descendents mean immediate child or no of node from that node to leaf ??

if immediate then :
let total n nodes are in binary tree.
2*non_leaf node  + 1 = total node
non leaf node = (total node -1)/2 = (n-1)/2
no of leaf node + no of nonleaf node = total node
no of leaf node + (n-1)/2 = n
no of leaf node = (n+1)/2
                            =  (n-1 + 2)/2
                            = (n - 1)/2 + 1
                            = no of non leaf node + 1
1 1 vote

Here we need to first understand on what should we apply induction . First of all it can't be on the number of nodes in the tree as each non-leaf node has $2$ nodes. So the induction must be on the level of the binary tree. Let $x_{k}$ denote the number of non-leaf nodes and $y_{k}$ the number of leaf nodes when the binary tree is in $k$-th level. We neee to establish that for $k≥0$,

$$x_{k}=y_{k}-1   ..........eq(1)$$

BASE CASE:-

 At level-0 there is only one node (which is also the leaf node). Here $x_{0}=0$ and $y_{0}=1$ which is in accordance with eq$1$. This establishes the base case.

INDUCTION STEP

Let eq$1$ be true until level-$k$. We will prove it to be true for $k+1$. Hence,

$$x_{k}=y_{k}-1$$

Let's get to the level-$k+1$. Now,

$$y_{k+1}=2y_{k}$$ and 

$$x_{k+1}=x_{k}+y_{k}$$

It's easy to verify that,

$$x_{k+1}=y_{k+1}-1$$ from the above two equations.

CONCLUSION:-

 By the induction step it could be concluded that for all $k≥0 $,

$$x_{k}=y_{k}-1  $$

Position:
Show:

Related questions

22 22 votes
6 answers 6 answers
6.5k
6.5k views
Kathleen asked Sep 29, 2014
6,544 views
Consider a singly linked list having $n$ nodes. The data items $d_1, d_2, \dots d_n$ are stored in these $n$ nodes. Let $X$ be a pointer to the $j^{\text{th}}$ node $(1 \...
35 35 votes
3 answers 3 answers
9.9k
9.9k views
Kathleen asked Sep 29, 2014
9,937 views
The following Pascal program segments finds the largest number in a two-dimensional integer array $A[0\dots n-1, 0\dots n-1]$ using a single loop. Fill up the boxes to co...
20 20 votes
2 answers 2 answers
4.5k
4.5k views
go_editor asked Feb 5, 2018
4,501 views
The following relations are used to store data about students, courses, enrollment of students in courses and teachers of courses. Attributes for primary key in each rela...
45 45 votes
6 answers 6 answers
9.0k
9.0k views
Kathleen asked Sep 29, 2014
9,043 views
Let $\left(\{ p,q \},*\right)$ be a semigroup where $p*p=q$. Show that:$p*q=q*p$ and$q*q=q$