The main idea of this project is to create a program that can compress and decompress text data.
(1)File Reading and Sorting
Implement a class that reads the input file (that only contains ASCII characters). Choose an appropriate data structure to keep track of the characters read and the count.
(2)Building the Huffman Tree
Given the collection of characters and their respective frequency (count), build an appropriate Huffman Tree that would optimally compress the text.
(3)Writing the Compressed Text
Write the compressed text to the specified output file in base64 format. Make sure to include the encoding chart so you can decode it later!
(4)Reading the Compressed Text
You should be able to read the encoding chart and then start converting the compressed text back to normal. Maybe you dont have to reconstruct an entire tree, but there must be a way to decode the bits. Remember that you also need to translate the base64 characters to useful bits first. Your program must be able to read the compressed text independently without any extra information passed from before (such as the original Huffman Tree object).
(5)Writing the Decompressed Text
To avoid confusion, having a filename system other than "input.txt/output.txt" is probably a good idea here. This is because your "input" could be plaintext to be compressed, or compressed text to be decoded.
(6)Structure
Your main function should be able to control which operation(s) to perform, given the input/output file(s) for the operation(s). For example, you should be able to easily specify a routine to compress input1.txt, input2.txt, and input3.txt to output1.txt, output2.txt, and output3.txt, respectively. Having non-essential functions in the main method will result in points deduction. A good idea is to keep each class independent and flexible. For example, the writing compression method (or class object) should be able to take a Huffman Tree object and a FileWriter object as two arguments, instead of hard-coding the file writing routine to output.txt, right after the tree is built.
(7)Style
You should aim for a clear writing style, for example, correct indentations, consistent bracket locations, and meaningful variable names.
(8)Documentation
Your documentation page should have a brief description about how your program works.