This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: CPSC 320: Intermediate Algorithm Design and Analysis Assignment #3, due Wednesday, October 13 th , 2010 at 13:30  1. Huffman codes (a) Show how to construct an input for which the prefix tree generated by Huffman’s algorithm will have all of its leaves on the same level. You construction should work for infinitely many alphabet sizes m (for instance, it might work whenever m is even, or when m is a perfect squares m , or when m is a power of 2, or when m is a prime, etc). Prove that your inputs result in prefix trees with the requested property. (b) Now, show how to construct an input for which the prefix tree generated by Huffman’s algorithm will have exactly one leaf on each level, except for the top level (where the root is the only node, but is not a leaf) and the bottom-most level (where there will be two leaves that are siblings). Your construction should work for any alphabet size m ≥ 2. Prove that it results in a prefix tree with the requested properties. Hint: start by figuring out how to do it for m = 2 , 3 , 4, and then see if you can generalize your construction to arbitrary values of m ....
View Full Document