28-Assignment-6-Huffman

28-Assignment-6-Huffman - CS106X Autumn 2010 Handout 28...

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

View Full Document Right Arrow Icon
CS106X Handout 28 Autumn 2010 November 8 th , 2010 Assignment 6: Huffman Encoding Assignment was pulled together by Owen Astrachan (of Duke University) and polished by Julie Zelenski. Huffman encoding is an example of a lossless compression algorithm that works particularly well on text and, in fact, can be applied to any type of file, not just text files. It can reduce the storage required by a third or half or even more in some situations. Hopefully, you will be impressed with this awesome algorithm and your ability to implement such a nifty tool! You are to write a program that allows the user to compress and decompress files using the standard Huffman algorithm for encoding and decoding. Carefully read the Huffman handout (Handout 29) for background information on compression and the specifics of the algorithm. This handout doesn't repeat that material, and instead just describes the structure of the assignment. Even so, this handout is on the long side. It preemptively identifies the more tricky pitfalls, but we learned during part offerings that several critical details we're easily overlooked by students skimming the handout a bit too quickly. We encourage you to give the handout your full attention, and we even marked a few sections with a large star to make extra-certain you don't miss some essential facts. Due: Wednesday, November 17 th at 5:00 p.m. Overview of the program structure Like all complex programs, development goes more smoothly if the task is divided into separate pieces that can be developed and tested incrementally. We have already divided the task up into four modules: huffman —This module contains the main function, responsible for responding to user requests to compress and decompress files. It uses an Encoding object to build the encoding and bstream objects to read and write encoded bit patterns to and from disk. pqueue —This is a generalization of the priority queue from Assignment 4. The priority queue is used by an Encoding object to manage the node collection when building an encoding tree. We’re including a template version of the PQueue with the starter files so you don’t have to templatize any priority queue data structures yourself. encoding —The module defines and implements a class for managing a Huffman encoding. It should have operations to build an encoding tree and map from character to bit pattern and back. It also is responsible for reading and writing the file header containing the encoding table.
Background image of page 1

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

View Full DocumentRight Arrow Icon
2 bstream —This class is already written for you. It defines new stream classes with specialized I/O operations to read and write single bits to and from a stream. The structure of each of the new modules is described in more detail in the sections that follow. The
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/13/2011 for the course CS 106X taught by Professor Cain,g during the Fall '08 term at Stanford.

Page1 / 8

28-Assignment-6-Huffman - CS106X Autumn 2010 Handout 28...

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

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