简体   繁体   中英

How to decompress a string in huffman coding?

I compressed the "abc" word into "01100111" using haffman coding algorithm . I built the tree . According to tree a=01, b=100 , c=111 . how to decompress this word ?

That is not a Huffman code. A Huffman code is a prefix code that uses all possible bit patterns. The prefixes 00, 101, and 110 are not used.

To decode a prefix code, you effectively traverse the tree starting at the root until you get to a leaf. Then you emit the symbol at the leaf and start over again at the root.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM