oClass-5-10-10

oClass-5-10-10 - BINARY TREES next next Leaf letter codes...

Info iconThis preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon
BINARY TREES next
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
next
Background image of page 2
Leaf letter codes Using these codes a Fle with letter frequencies N N N N N N N A B C D E G ± Could be stored using a total of bits Can we do better by using another tree? What is the best tree? next
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Leaf heights of binary trees Incomplete tree Complete tree Proof By induction on the height of the tree Assume the result true for all trees of height less than k a) Every binary tree of length k decomposes into one or two trees of length less than k b) all the heights increase by one --> all denominators increase by a factor of 2 next QED!! 1/2 1/2
Background image of page 4
The Huffman Code The goal is to use a code that gives shorter codes to the more frequent letters in order to minimize the number of bits used in to store the Fle The following algorithm gives the optimal tree Each step is the same: join the two partial trees with minimum total weight Notice that we rearrange the sequence of nodes so that the weights increase from left to right total weight next
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Continuing the construction next
Background image of page 6
Final Tree 0 0 0 0 0 0 1 1 1 1 1 1 Note using the formula We get (Pretty good!) 2.62165 next
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 8
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 09/22/2010 for the course MATH MATH187 taught by Professor Math187 during the Spring '10 term at UCSD.

Page1 / 13

oClass-5-10-10 - BINARY TREES next next Leaf letter codes...

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online