# 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 Wed Mar 13 12:42:46 2019.

Cite this as:

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