Some Tree Arithmetic

Properties of Trees:



_________________________________________________________________

Lemma:

Given a Tree $\QTR{Large}{T}$ $\QTR{Large}{\ }$with Root MATH , let MATH be the set of its Leaf Nodes and MATH, and let MATH. Finally, let $\QTR{Large}{N}$ be a Child of MATH then

MATH

Proof:

The set of Leaves of MATH is a subset of the set of Leaves of $\QTR{Large}{T}$. Moreover any such Leaf, in MATH has Depth 1 less it does in $\QTR{Large}{T}$.

________________________________________________________________________

Theorem (Kraft's inequality for Binary Trees):

  1. Given a Binary Tree $\QTR{Large}{T}$ $\QTR{Large}{,}$let MATH be the set of its Leaf Nodes and MATH then MATH MATH

  2. Conversely, given MATH such that MATH MATHthen we can find a Binary Tree $\QTR{Large}{T}$ $\QTR{Large}{,}$and Leaf Nodes MATH of $\QTR{Large}{T}$ $\QTR{Large}{,}$ such thatMATH .

Proof:

The proof will be by induction on MATH

To prove 1.

The case MATH:

MATH implies that $\QTR{Large}{T}$ is just the Root Node hence the Lemma amounts to showing MATH



The case MATH:

Since $\QTR{Large}{T}$ is Binary $\QTR{Large}{T}$ is either of the form MATH. with a single Edge MATH or MATH. with Edges MATH and MATH .

In the first case we just observe MATH and in the second MATH.


In general:

Since $\QTR{Large}{T}$ is Binary $\QTR{Large}{T}$ , MATH has either one Child MATH or two Children MATH.

One Child, the Leaves of MATH are identical to the Leaves $\QTR{Large}{T}$ of but their Depth with respect to MATH is $\QTR{Large}{1}$ less so

completing the proof amounts to observing that if MATH MATH then MATH MATH

Two Children, the Leaves of $\QTR{Large}{T}$ is the disjoint union of the Leaves of MATH and the Leaves of MATH .

Exercise: Finish the arithmetic.


To prove 2.:

By reordering, if necessary, we can assume MATH

The cases $\QTR{Large}{n=1}$ and $\QTR{Large}{n=2}$ amount to drawing the appropriate $\QTR{Large}{1}$ or $\QTR{Large}{2}$ branch tree.


In general, by induction on $\QTR{Large}{n}$:

If MATH.

We can find a Tree, MATH , for the list MATH where MATH, MATH and MATH

To complete the proof, just fork the Leaf in MATH corresponding to MATHEach of the two new leaves have Depth MATH

If MATH ,

We have MATH MATHand hence MATH MATH

( Exercise: Why?, a minor variant of a previous argument about Huffman Codes$\QTR{Large}{.\ }$See Hint belowMATH)

The remainder of the proof is a variant of the case MATH. First construct the Tree for MATH

Next fork the leaf for MATHappropriately.




Hint: Show that, in general with MATH and $\QTR{Large}{j\ <n}$

MATH MATH , some MATH

and since MATH MATH

MATH MATH