CIS 658 Programming Assignment #4

Total Page:16

File Type:pdf, Size:1020Kb

CIS 658 Programming Assignment #4

CIS 465 Programming Assignment #1 Due date: 4pm, Wednesday, February 18.

Program: Implement binary coding for run-length coding codewords.

Input: Two lines of input: first line contains a list of symbols in the alphabet, separating by one or more spaces; second line gives the maximum run length, the number of symbols in the uncompressed input and the number of codewords in the output (the actual sequence of codewords is not given).

Output: You should first output the coding table – one line per codeword in the RLC. Each line contains a symbol from the RLC and its coding (e.g. (A, 3) – 1001). Next you should compute and output the compression ratio of the run length coding.

Note that your 0s and 1s output is in ASCII format – you don’t need to work with any binary format data in this assignment.

Example run of program:

Input the symbols in the alphabet: A B Input the maximum run length, number of symbols in uncompressed input and the number of codewords in the RLC coding: 1 100 100

Binary coding of the codewords ------(A, 0) 00 (A, 1) 01 (B, 0) 10 (B, 1) 11

Compression ratio = 100*1 bits / 100*2 bits = 0.50 (No compression!)

Your program can be in any language with executable on Windows 7, Mac OS X or Linux (be sure to tell me which is the target for your executable!).

Submit: Source code (well formatted and with plenty of internal documentation), executable code (or class files for Java, for an interpreted language, no executable is required), document file (text format – include instructions for running your program and any limitations on input etc.), test cases (in another text file).

Note well – I will not compile your program - you must submit the executable! You should compress all of your files using zip format (not rar format or any other) and send the file to [email protected] by the due date/time.

Recommended publications