Huffman Encoding Algorithm Project using java
This project implements Huffman Encoding, a greedy algorithm used for data compression. The program reads characters and their frequencies from an input file, builds a Huffman Encoding tree, generates variable-length codes for each character, encodes messages, and calculates compression percentages. It also compares the performance of different priority queue implementations. Features
- Build and display the Huffman Encoding Tree.
- Generate Huffman codes for input characters.
- Encode messages into their corresponding Huffman codes.
- Calculate compression percentage compared to 8-bit ASCII encoding.
- Measure and compare the running times of the algorithm using:
- Min-Heap as the min-priority queue.
- Ordered Array as the min-priority queue.
Problem Statement
Given a set of characters with their probabilities, this program:
- Builds the Huffman Encoding Tree.
- Finds and displays variable-length codes for input characters.
- Encodes a message using the Huffman codes.
- Calculates compression percentage.
- Measures algorithm performance using different priority queue structures.
The input is read from input.txt
Sample output:
