質問

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?

役に立ちましたか?

解決

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.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top