Starting from:
$30

$24

Laboratory Exercise 3


Laboratory Exercises

This laboratory exercise is to create an initial version of Assignment 3, Huffman encoding and decoding. For this lab, you are to create a program, htable, that will generate the table of encodings appropriate for a given file.

Usage:

htable <filename>

Your program must:

    • Read the input file and build the Huffman code tree according to the rules given in Assignment 3; and

    • Write this encodings described by this code tree to standard out according to the following format:

– Only bytes that are present in the file are included in the table

– Bytes are included in the table in numerical order

– Each line of the table consists of the byte as a two-digit hexadecimal number followed by a colon and a space, followed by the binary encoding represented by the characters ‘0’ and ‘1’.

Example: 0x61: 101

You may use any kind of IO you like for this, the restrictions for Assignment 3 do not apply.



1





What to turn in

Submit via handin on the Unix servers to the lab03 directory of the ngonella account:

    • your source files.

    • A makefile (called Makefile) that will build your program when given the command make htable.

Sample Runs

    • cat test aabbccddd
    • htable test 0x0a: 100 0x61: 101

0x62: 00

0x63: 01

0x64: 11

    • 































2

More products