霍夫曼COM pression算法 [英] Huffman compression algorithm

查看:150
本文介绍了霍夫曼COM pression算法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用霍夫曼算法实现文件COM pression,但我的问题是,为了使COM pressed文件DECOM pression,编码树中使用,或codeS本身应该写入文件太。现在的问题是:我如何做到这一点?什么是在COM pressed文件的一开始就?

I've implemented file compression using huffman's algorithm, but the problem I have is that to enable decompression of the compressed file, the coding tree used, or the codes itself should be written to the file too. The question is: how do i do that? What is the best way to write the coding tree at the beggining of the compressed file?

推荐答案

有一个pretty的标准实现哈夫曼编码的在基本的COM pression库(BCL),包括一个递归函数写树到一个文件。看看huffman.C。它只是写出来的树叶,才能使德codeR可以重建同一棵树。

There's a pretty standard implementation of Huffman Coding in the Basic Compression Library (BCL), including a recursive function that writes the tree out to a file. Look at huffman.C. It just writes out the leaves in order so the decoder can reconstruct the same tree.

首创置业也不错,因为有一些其他的pretty的简单的COM pression算法件那里。这是如果你需要推出自己的算法非常方便。

BCL is also nice because there are some other pretty straightforward compression algorithm pieces in there, too. It's quite handy if you need to roll your own algorithm.

这篇关于霍夫曼COM pression算法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆