Huffman coding in C An example for the Spring 2007 Algorithms class Jim Mahoney (mahoney@marlboro.edu) --- files ------------------------------- README.txt this file output.txt what it looks like when you run it Makefile compilation rules test_framework.h APIs for : tests huffman.h various huffman tasks utility.h general purpose stuff heap.h heap (i.e. priority queue) routines test_framework.c C source files without main() huffman.c utility.c heap.c heap_test.c C sources with main: tests on the heap heap_stats.c measure heap performance huffman_test.c tests on huffman routines run_huffmain.c analyze huffman heap_test executables heap_stats huffman_test run_huffman moby_dick.txt text file to analyze for character frequencies *.o object files --- compiling and running it ---------------------- $ make $ make test # optional; see output from various tests $ make clean # optional; remove intermediate files $ ./heap_stats # print performance measures, i.e. size vs creation steps $ ./run_huffman # print huffman codes generated from moby_dick.txt char frequencies. The output from all that can be seen in output.txt. --- resources -------------------------------------- a related open source toolkit : C prototyping tools http://sourceforge.net/projects/cprops libcprops-0.1.6.tar.gz Levitin's "Design & Analysis of Algorithms, 2nd ed"