Wolfram Computation Meets Knowledge

HuffmanEncode

Contributed by: Stephen Wolfram

Find a Huffman encoding from a list.

ResourceFunction["HuffmanEncode"][list]

gives an optimal binary Huffman encoding for the data represented by list.

Details and Options

From A New Kind of Science, page 1071.

Examples

Basic Examples

Find the Huffman encoding for a string:

In[1]:=
ResourceFunction[
 "HuffmanEncode"]["compression is based on redundancy"]
Out[1]=
In[2]:=
ResourceFunction[
ResourceObject[
Association[
   "Name" -> "HuffmanDecode", "UUID" -> "11b4c445-8a85-43ff-b39f-d29cda456788", "ResourceType" -> "Function", "Version" -> "1.0.0", "Description" -> "Decode data specified by a Huffman encoding.", "RepositoryLocation" -> URL[
     "https://www.wolframcloud.com/objects/resourcesystem/api/1.0"], "WolframLanguageVersionRequired" -> "10.0", "SymbolName" -> "FunctionRepository`$\
e4712af5232b4f3c8b384b50ddcd96dc`HuffmanDecode", "FunctionLocation" -> CloudObject[
     "https://www.wolframcloud.com/objects/eaa6548f-d884-48b2-8365-\
9aee16956b8f"], "ShortName" -> "HuffmanDecode"], {
   ResourceSystemBase -> Automatic}]][%]
Out[2]=

Resource History