Cosc 2P03 Fall 2017
Bonus Assignment
(Due at start of 2P03 Exam)
Bonus Assignment
This is a bonus assignment and is optional. If completed, it will be
worth 4% of your grade.
LZW compression
For this assignment you will be implementing the LZW compressor and
de-compressor. Lets not reinvent winzip but concentrate on the
algorithm. Consider a data file composed
of 0's, 1's, blanks (char 32) and the EOL character. Hence the
alphabet is 4 characters in length.
Write a compressor which will compress the data file to a list of
integers which represent the encoded file. To aid in the look up of
character strings implement a hash table using external chaining.
The size of the table will be 301. Consider a code string C
composed of characters Ci sequentially numbered where i>=1. Thus
the following hash function may be used. Use the ASCII ordinal
value.
f(C)=SumOf(87*i*ord(Ci)) mod TableSize.
The decompressor will read the integer file and recreate the
original data file.
Output
Print a copy of the code table, after compression and after
decompression. Include a copy of the decompressed data file.
Submission Requirements:
- Cover Sheet completely filled out, available
from: "http://www.cosc.brocku.ca/forms/cover"
Note: your assignment will not be marked unless one is submitted
with the assignment on the assignment due date.
- Commented and properly documented source code
listing, use Java Doc style.
- Listing of any input you used to test your program.
- Listing of your output which reflects the input.
- Source code is to be Java.
- Be sure to hand in a hard copy of the above and a soft copy as
directed below.
- Electronic
submission, run the script "submit2p03" from sandcastle.
- Statement on coversheet with following information.
- Platform, e.g. Mac, PC, Commodor 64, my Java enabled wrist
watch.
- Compiler Version, e.g. Java 1.7, Java 1.81 e.g.
Good Luck