# k-ary Huffman coding

(algorithm)

**Definition:**
A minimal variable-length coding based on the frequency of each character. Similar to a *Huffman coding*, but joins k trees into a *k-ary tree* at each step, and uses k symbols for each level.

*Note:
The coding at each stage has k symbols, not just 2 (0 or 1) like traditional Huffman. If k is a power of two, that is, k=2*^{n}, every symbol can be represented by n bits.

Author: PEB

## Implementation

animation which counts characters, finds the code, encodes, and decodes (Java),

Go to the
Dictionary of Algorithms and Data
Structures home page.

If you have suggestions, corrections, or comments, please get in touch
with Paul Black.

Entry modified 27 October 2005.

HTML page formatted Fri Feb 23 10:06:07 2018.

Cite this as:

Paul E. Black, "k-ary Huffman coding", in
*Dictionary of Algorithms and Data Structures* [online], Vreda Pieterse and Paul E. Black, eds. 27 October 2005. (accessed TODAY)
Available from: https://www.nist.gov/dads/HTML/karyHuffman.html