基于霍夫曼无损压缩算法和解码器的 C++ 压缩程序。
Huffman Coding
Self-made C++ file archiver and archive extractor programs based on Huffman's lossless compression algorithm
You can check out documentation inside Compressor.cpp and Decompressor.cpp files to help you understand Huffman's algorithm's inner workings.
The Compressor is a 2-pass program. What I mean by this is that the Compressor reads input files twice.
In the first pass, the program counts usage frequency of every unique byte and creates a weighted translation tree for every used unique byte inversely proportional to its usage frequency and then writes this transformation info to the compressed file for decompression purposes
In the second pass, the program translates input files according to the translation tree and writes it to the newly created compressed file
The Decompressor is a 1-pass program:
The Decompressor first reads translation info and creates a binary tree from it. After this process is done, it uses this binary translation tree to decode the rest of the file
make using your favourate shell:make allarchive command below to compress the file you want:./archive {{filename}}./archive {{filename1}} {{filename2}} ...extract command below:./extract {{filename}}暂无开放 Issues,或尚未同步最近议题。