Template Function ADS::huffman

Function Documentation

template<class C, class F>
std::map<C, std::string> ADS::huffman(const std::map<C, F> &freq)

the codes of Huffman of the characters with the given frequencies, at least one; a single character gets the code “0”

Pre:

freq not empty, no frequency negative

Post:

a prefix-free code of each character