Experimental project for coding up a compression tool using Huffman algorithm.
This project implements a file compression and decompression utility using Huffman Coding, a lossless data compression algorithm.
- Huffman coding generates prefix codes, meaning no code is a prefix of another. This ensures that the encoded data can be uniquely decoded without ambiguity.
- It produces the shortest possible average code length for a given set of symbols and their frequencies, making it optimal for compression.
- Compression and decompression can be performed in linear time with respect to the input size, making it suitable for real-time applications.
- Huffman coding can be adapted to different types of data by analyzing the frequency of symbols in the input.
- The Huffman tree is built dynamically based on the input data, making it flexible and adaptable.
- Compression: Compresses a text file using Huffman encoding and saves the output as a binary file.
- Decompression: Decompresses a binary file back into its original text format.
- Command-Line Interface: Simple command-line interface for easy usage.
The tool is operated via the command line. Below are the available commands:
To compress a text file, use the -c option followed by the filename:
java Main.java -c "filename.txt"To decompress a text file, use the -d option followed by the filename:
java Main.java -d "filename.txt"- Compression / Decompression of Images
- GUI interface; not command-line