传统的哈夫曼编码的实现方式是在构造哈夫曼的基础上,从叶子节点到根节点逆向进行的。为了提高编码的效率,给出了一种新的哈夫曼编码实现方式,该方式通过利用二叉排序树的数据结构,从哈夫曼的根节点出发,向叶子节点进行编码,在编码过程中仅将哈夫曼树的每个叶子节点进行一次扫描便可以得到各个叶子节点的哈夫曼编码。该方法不仅符合编码的思维方式,而且解决了原先编码过程中大量指针移动的问题。
The traditional way to achieve huffman coding is from leaf nodes to the root node on the basis of the huffman tree.In order to improve coding efficiency,It prsents a new implementation approach of the huffman coding,in which codes go from the root node to leaf nodes of the huffman tree by using the binary sort tree.In the coding process,every leaf node is only scanned once before getting the huffman coding.This method not only coincides with the thinking of encoding mode,and solves the problem of a large number of pointers' movement.