A Huffman code is a particular type of optimal prefix code that is commonly used for lossless data compression. You can read more about it here: https://en.wikipedia.org/wiki/Huffman_coding
Encoding:
- Build a frequency table for the dataset.
- Build a Huffman Binary Tree from the given frequency table with the best performance priority-queue data structure(choice between Binary, 4-Way and Pairing Heap).
- Generate as output an encoded file and a code table file (used to decode an encoded file).
Decoding:
- Take as input a code table and an encoded file and construct a binary Huffman tree from the given code table.
- Use the binary tree to decode the encoded binary file to generate a decoded file.
Command to build the java files:- make This command should produce two binary files: encoder and decoder(along with other required class files).
To run encoder: java encoder <input_file_name>
Running encoder program will produce the output files with exact name "encoded.bin" and "code_table.txt".
On the other hand, decoder will take two input files. We will run it using following command:
java decoder <encoded_file_name> <code_table_file_name>
In this case: java decoder encoded.bin code_table.txt
Running decoder program will produce output file with exact name "decoded.txt".