📦 File Compression Using Huffman and LZW
💡 Inspiration
With the explosion of digital data, efficient storage and faster transmission have become essential. We aimed to build a tool that compresses text files using classical algorithms like Huffman Coding and LZW — combining academic depth with practical use.
⚙️ How We Built It
- Implemented in C++ using standard template libraries
- Huffman Coding: Frequency-based binary tree encoding
- LZW Compression: Dictionary-based approach for repeating patterns
- Used file I/O for reading/writing large files efficiently
- Developed a simple CLI for user-friendly input/output file handling
🔍 Features
- Support for
.txtfiles - Huffman compression with visualized tree construction
- LZW compression with dynamic dictionary building
- CLI-based usage: fast, lightweight, and portable
- Accuracy testing by comparing file sizes pre- and post-compression
🧩 Challenges Faced
- Bit-level file writing in C++ required custom handling
- Handling special cases like repeated characters or very short files
- Debugging binary I/O and tree traversal issues
📚 What We Learned
- The inner workings of compression algorithms
- Managing file operations and memory usage in C++
- Balancing compression ratio vs. performance
- Importance of clean code structure for algorithm-heavy logic
Built With
- c++
- cli
- file-i/o
- huffman-tree
- lzw-algorithm
- stl
Log in or sign up for Devpost to join the conversation.