{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}


31-Assignment-5-Huffman - CS106X Winter 2008 Handout 31...

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

View Full Document Right Arrow Icon
CS106X Handout 31 Winter 2008 February 22, 2008 Assignment 5: Huffman Encoding Assignment was pulled together by Owen Astrachan (of Duke University) and polished by Julie Zelenski. Huffman coding 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 given in lecture 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 the first few 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: Monday, March 4 th at 1:15 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 program, 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 will be your handy dandy priority queue from Assignment 4. The priority queue is used by an Encoding object to manage the node collection when building an encoding tree. You will templatize the priority queue you wrote for Assignment 4 (or any one of ours if you’re worried yours aren’t solid), and use that to assist in the implementation of this new assignment. 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 Document Right 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
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.

{[ snackBarMessage ]}

Page1 / 10

31-Assignment-5-Huffman - CS106X Winter 2008 Handout 31...

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

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