Overview
A Java Swing application that compresses and decompresses files and whole directories with Huffman coding, draws the resulting code tree, and benchmarks the priority-queue implementations used to build it.
Huffman coding is the textbook greedy algorithm: count how often each symbol appears, put every symbol in a priority queue keyed by frequency, and merge the two least frequent nodes over and over until one tree is left. Frequent symbols come out with short bit codes, so the encoded file approaches the entropy of the source. The application builds that tree, encodes the payload into a bitstream, writes a self-describing archive (header, codes, bits) and decodes it back to a file identical to the original.
The priority queue is the part that decides how long building the tree takes, so it is interchangeable: four implementations are measured against each other over the same input, which turns the practice into a benchmark rather than a single answer.
Project 4 of 7 for the Advanced Algorithms course at the Universitat de les Illes Balears, the one on greedy algorithms.
javagreedy-algorithmsdata-compression