Harman coding and decoding

Source: Internet
Author: User

I. experiment content
[Problem description]
The use of Harman encoding for residential communication can greatly improve the channel utilization, shorten the residence transmission time, and reduce the cost. However, this requires that the data transmitted on the sending end be pre-encoded through an encoding system, the receiver decodes (restores) The transmitted data through a decoding system. Each end has a complete encoding and decoding system for two-way transmission information channels, I tried to write a coding and decoding system for such a residence receiving and receiving station.

[Basic requirements]: a complete system should have the following functions:
(1) I. initialize (Initialization ). Read the character set size n, n characters, and n weights from the terminal, create a user-defined tree, and store it in the hfmTree file.
(2) E. Encoding (Encoding ). Encode the text in ToBeTran and save (transmit) The result code to the file CodeFile using the established Harman tree (read from the file hfmTree if not in memory.
(3) D. Decoding ). Use the built Harman tree to decode the data code in the transmitted CodeFile and save the decoding result to the TextFile.
(4) P. Print the file code (Print ). The file CodeFile is displayed on the terminal in a compact format with 50 codes per line. At the same time, write the encoding file in the form of this character into the file CodePrin.
(5) TreePrinting ). Display the user tree in memory in an intuitive way (in the form of a tree or a concave table) on the terminal, and write the user tree in the form of this character into the file TreePrint.

Test data:
(1) Use Data in Example 6-2 of the textbook to debug the program.
(2) Use the character set and frequency statistics given in the following table to establish the Hamman tree and implement the encoding and decoding of the following packets: "this program is my favorite "..
Character A B C D E F G H I J K L M
Frequency 186 64 13 22 32 103 21 15 47 57 1 5 32 20
CHARACTER N O P Q R S T U V W X Y Z
Frequency 57 63 15 1 48 51 80 8 18 1 16 1

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.