This project implements a lossless text compression and decompression algorithm using Huffman coding. It encodes files into a compressed binary format with an embedded Huffman tree, allowing accurate reconstruction of the original data.
- Lossless Compression & Decompression
- Uses Huffman coding to efficiently reduce file size while ensuring perfect reconstruction.
- Binary Encoding Tree Reconstruction
- Stores the Huffman tree within the compressed file for accurate decoding.
- High Compression Efficiency
- Achieves significant file size reduction (e.g., 6337 KB → 3597 KB), optimizing storage and transmission.
- C++
- Filesystem Manipulation
-
Compression
- Reads the input text file.
- Builds a frequency table for characters.
- Constructs a Huffman tree and generates binary codes.
- Encodes the file into a compressed binary format, embedding the Huffman tree.
-
Decompression
- Reads the compressed file.
- Reconstructs the Huffman tree from the stored metadata.
- Decodes the binary data back into the original text.
g++ -o compressor compressor.cpp
g++ -o decompressor decompressor.cpp📺 Demo Video
small.project.explaination.mp4
🔗 Related Links Huffman Coding - Wikipedia