spec-bonus - CSE 143 Winter 2010 Assignment#8-B Huffman...

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

View Full Document Right Arrow Icon
1 of 2 CSE 143, Winter 2010 Assignment #8-B: Huffman Bonus (up to +3 extra credit points) Due Sunday, March 14, 2010, 11:30 PM (no late submissions accepted) This "secret" extra program is an extra credit extension to your HW8 Huffman program. Turn in files named HuffmanTree.java and HuffmanTree2.java from the Homework section of the web site. You should also re- download HuffMain.java , Bit(In/Out)putStream.java and download HuffMain2.java from the web site. This problem is meant to be tricky. The TAs will provide less help on extra credit than they would on ordinary features. NOTE: You must still turn in regular HW8 the normal way. We won't grade your HW8-B as though it were HW8. Description: Real compression programs do not require two separate files the way our Huffman program does. Storing character counts in a separate .counts file is clunky and is not a behavior that the client would appreciate. If you choose to complete this optional extension to Homework 8, you will merge your Huffman-compressed binary file and its associated .counts file into a single compressed archive. You will also write code so that you are able to decompress such a file. In this assignment you will turn in a new class HuffmanTree2 that is an extension of HuffmanTree by inheritance. HuffmanTree2 extends and overrides the behavior of its superclass to cause it to compress files without the need for a separate .counts file. Specifically, your HuffmanTree2 class must have the following new constructor and methods: public HuffmanTree2(Map<Character, Integer> counts) In this constructor you should initialize your Huffman tree, as was done in the superclass. If the tree is going to be used to compress a file, you will be passed a map of character counts as normal. However, if you are decompressing a file, the main program won't know its counts of characters because it will not have a .counts file; so in this case your tree will be passed a map with only a single entry: EOF. So when a Huffman tree is being constructed to decompress a file, the tree is essentially empty to start. You must wait until decompressing a file to restore your overall tree and encodings. Note that subclasses' constructors must always call a constructor from their superclass in order to compile.
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 2

spec-bonus - CSE 143 Winter 2010 Assignment#8-B Huffman...

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

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