ass3

# ass3 - CPSC 320: Intermediate Algorithm Design and Analysis...

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
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CPSC 320: Intermediate Algorithm Design and Analysis Assignment #3, due Wednesday, October 13 th , 2010 at 13:30 [9] 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

## This document was uploaded on 10/11/2010.

### Page1 / 2

ass3 - CPSC 320: Intermediate Algorithm Design and Analysis...

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

View Full Document
Ask a homework question - tutors are online