Skip to content
This repository was archived by the owner on Jun 17, 2026. It is now read-only.

Latest commit

 

History

History
39 lines (29 loc) · 1.29 KB

README.md

File metadata and controls

39 lines (29 loc) · 1.29 KB

DeepAlpha — Huffman Coding

An object-oriented implementation of Huffman coding in C++: build a Huffman table from text or a word-frequency table, then compress and decompress arbitrary strings against it. Part of the personal DeepAlpha trading/quant project series (used for log compression in deepalpha-logging).

Tech stack: C++17 · CMake · Boost (dynamic_bitset) · fmt

Features

  • Build a Huffman table from raw text or from a precomputed word/frequency map.
  • Compress and decompress strings using the generated table.
  • Serialize the Huffman table to/from a string for storage and reuse.
  • Inspect table statistics (average and longest code length, predicted encoded/decoded sizes).
  • Clean OOP separation: huffman (facade) over huffman_tree and huffman_table.

Project structure

├── main.cpp
└── huffman/
    ├── header/  huffman.h, huffman_table.h, huffman_tree.h
    └── src/     huffman.cpp, huffman_table.cpp, huffman_tree.cpp

Build & run

cmake -S . -B build      # fetches fmt automatically; requires Boost installed
cmake --build build
./build/huffman

Part of the DeepAlpha series — a from-scratch, OOP take on Huffman compression using bit-level data structures.