Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1. Proof by induction
- Definition of a leaf as a refresher:
- Leaf- a node with no children
- Mathematical theorem:
- L(I) = I+1; where I denotes the amount internal nodes
- Basis Step:
- A tree with only one vertex is considered to have one internal node with no children
- Thus L(0) holds
- Inductive hypothesis:
- Imagine a tree with n internal nodes, now remove two sibling leaves at any random node.
- Let that sub-tree be T’
- Then that sub-tree has n-1 internal nodes.
- As a result let y = L(I) = I+1
- By algebraic manipulation that implies L(I-1) = I
- Hence by inspecting the following formula manipulation one can see that adding two leaves implies increasing the internal node count by 1. As a result the theorem holds because deducting one internal node implies that we remove two leaves. Hence the inverse holds where adding an internal node yields two new leaves.
- L (n) = I+2-1 I+1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement