This Huffman Compression Program takes any text file and compress it into a binary file, decreasing its storage space. To use this program, first select whether you would like to compress or decompress the file. Then, provide the file you would to compress or decompress and the file you would like to receive the output you chose. After this, the program will run on its own and complete the task. When compressing, the program takes the file to be compressed and reads every single line to create a frequency map and a tree to decipher it. During this time, we also add an "end of text" character into the tree to be used later. Taking the codes, we create a header to be used later during decompression as a dictionary. Then, we read through the file again, taking each character of each line and outputting its code into the binary file. When all characters have been inputted into the binary file, we finally add the "end of text" character. When the program is finished, you now have a compressed file. During decompression, we take the header of the file to use in rebuilding the tree. After this, we begin extracting from the binary file, traversing the tree and inserting characters into the output file until we reach the "end of text" character. This allows it so that we don't add any unnecessary characters when we are done decompressing.
maernest04/Huffman-Compression-and-Decompression
Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|