2c03-review - 00069

2c03-review - 00069 - So, prob(a) <= prob(c). Same proof...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
12 Another possible solution, in the similar style is the following. For any Huffman tree, if we combine two leaves, and use another symbol to represent it. Assigning the sum of probability of two leaves to the new symbol, we get a new Huffman tree for a new set of symbols, which have one symbol less. Take the example on text book, if we have a Huffman tree for a, b, c, d, e, with probabilities 0.12, 0.40, 0.15, 0.08, 0.25, we can combine a, d, then we have a new Huffman tree for, b, c, e, x, with probability 0.4, 0.15, 0.25, 0.2, where f is the combination of a and d. Now, let’s prove by induction. Let P be the proposition. Base case, the smallest Huffman tree, which has two leaves with different depth, has 3 leaves, ie for three symbols. It looks like following: c a b Now, depth(a), depth(b) > depth(c), suppose prob(a) > prob(c). Then list the symbol s in the order of probability from small to large will be “b, c, a” or “c, a, b” or “c, b, a”. For all cases, depth (a) <= depth(c), which is a contradiction to depth(a) > depth(c).
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: So, prob(a) <= prob(c). Same proof for prob(b) > prob(c). Induction Step, Assume P holds for Huffman tree with height n, show it holds for Huffman trees with height n+1. Let depth(a) > depth(b). Case 1, depth(a) <= n, then depth(b) < n. Use the technique above to combine all leaves, whose depth is n+1. Clearly, we get a new Huffman tree, in which a, b are leaves. The height of the new tree is n, and depth(a) > depth(b). By induction hypothesis, prob(a) <= prob(b). Case 2. depth(a) = n+1, ie a is a leaf. Again, Use the technique above to combine all leaves, whose depth is n+1. Then, we get a new Huffman tree, whose height is n. Then for a, it looks like: x a c where prob(x) = prob(a) + prob(c), and x will be a leaf in new tree. Lets do the same thing to b, y b T Now, x, y are leaves of new Huffman tree, whose height is n, and depth(x) > depth(y), Thus, by induction hypothesis, prob(x) <= prob(y)....
View Full Document

This note was uploaded on 12/10/2009 for the course CAS 2c03 taught by Professor Janicki during the Spring '03 term at McMaster University.

Ask a homework question - tutors are online