This project was done as an assignment for an undergrad-level data structures and algorithms course. It is designed to take an input file on the console and then output data to the console line relating to the huffman encoding process/results.
- Outputs all alphabetical characters in the input file in uppercase.
- Prints the frequency of each alphabetical character (case-insensitive) and the total frequency.
- Displays a tree that can be used to produce huffman codes for each alphabetical character.
- Prints the huffman codes for each alphabetical.
- Prints the total number of bits required to store the alphabetical characters in the input file using fixed-width, 5-bit codes for each character and then prints the total number of bits required to store the same data using the generated huffman codes.
tree_printer.hppwas supplied by my instructor. I performed minor modifications to enable it to work with my code.tree_printer.hppwas adapted by my instructor from Techie Delight.
- Other minor sources used are referenced in
huffman.cppwhere applicable
This program is a console app. To compile on a macOS terminal:
g++ -Wall -Wextra -std=c++20 huffman.cpp
To run with text file info.txt:
./a.out < info.txt
- This program considers only alphabetical characters in the input; any other characters will be ignored.
- Different letter cases of the same letter are treated the same.