Implementation of the compression algorithm based on the Harman Encoding

Source: Internet
Author: User

The coding of a user is dependent on the user tree.

The character string to be compressed uses the frequency of occurrence of each word as the basis to construct a user-defined tree. The more frequently the word is, the closer it is to the root node of the tree. Therefore, the shorter the encoding. Therefore, characters with high frequencies use short codes, and those with low frequencies use long codes. You can compress strings based on such a code table.

This program uses C.

Basically, it demonstrates the working principle of Harman encoding compression. Because it is a Demo code, you do not have to worry too much about efficiency. The program efficiency must be low.

According to the binary code consisting of a code table, the 7-bit ASCII code is converted into a group of ASCII code using 7-bit, 0-127), and there is a flag header to indicate whether there is excessive tail code. For more information, see code implementation.

This program can also be adapted to become a string encryption algorithm.

As follows:

650) this. width = 650; "style =" border-bottom: 0px; border-left: 0px; border-top: 0px; border-right: 0px "title =" inherit "border =" 0 "alt =" 967C955F6A784E96BB1EEF13EBEF0080 "height =" 211 "src =" http://www.bkjia.com/uploads/allimg/131228/1AI32164-0.jpg "/>

This article is from the "one blog" blog, please be sure to keep this source http://cnn237111.blog.51cto.com/2359144/1052372

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.