{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

28-Assignment-6-Huffman

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

Info icon This 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.
Image of page 1

Info icon This 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 follow.
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 ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern