Skip to content

Anshikakalpana/file-compression-utility-cpp

Repository files navigation

file-compression-utility-cpp

This project is a simple yet powerful file compression and decompression utility built in C++ using the Huffman Coding algorithm. At its core, it leverages a min-heap priority queue to dynamically construct the Huffman Tree—where the rarest characters rise to the top of the queue and the most common ones settle into shorter, more efficient binary codes. Once the tree is formed, the program generates unique prefix-free Huffman codes that dramatically reduce file size while preserving every bit of original information.

How to Run?

1. Compile the project

g++ main.cpp Huffman.cpp CharFrequencyAnalyzer.cpp -o huffman

2. Run the executable

./huffman

3. Select mode

Enter mode ('compress' or 'decompress'):

For example:-

If you choose compress for the input file , the output will be :-

Building frequency map... Building Huffman tree... Compressing file... Compression done in 3.497 sec Input Size: 6488666 bytes Compressed Size: 3695814 bytes Compression Ratio: 0.56958

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published