Question

I'm starting a new project, a text data arhivator, that will use Huffman coding.

What structure is better to use in implementation of such an algorithm?

My approach is to create a simply linked list that will contain binary trees in each node. In order to build the Huffman-tree.

Is there a better way?

Was it helpful?

Solution

If you're talking about generating the Huffman code from the symbol frequencies (your question is not clear), then the data structure can be implicit in the storage of the tree. In fact, the calculation can be done in place, over the frequencies. See In-Place Calculation of Minimum-Redundancy Codes.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top