Ghostwriting C++, C language Huffman coding/decoding system programming assignments, ghostwriting C program assignments

Write C++, C language Huffman coding/decoding system programming homework
1. Problem Description
Using Huffman coding for information communication can greatly improve channel utilization, shorten information transmission time, and
reduce transmission costs. However, this requires that the data to be transmitted be pre-encoded by an encoding system at the transmitting end;
and the transmitted data is decoded (restored) at the receiving end. For duplex channels (that is, channels that can transmit information in both directions
), a complete encoding/decoding system is required at each end. Try to write a
Huffman .
2. Basic requirements
a complete system should have the following functions:
(l) I: Initialization (Initialization). Read the character set size n, n characters and
m weights from the terminal, build the Huffman tree, and store it in the file hfmtree.
(2) C: Coding. Use the built Huffman tree (if not in memory,
read from the file hfmtree), encode the text in the file tobetrans, and then store the result in the file
codefile.
(3) D: Decoding. The code in the file codefile is
decoded using the built Huffman tree, and the result is stored in the file textfile.
(4) P: Print the code file (Print). Display the file codefile on the terminal in compact format,
50 codes per line. At the same time, the encoding file in the form of this character is written into the file codeprint.
(5) T: Huffman tree (Tree printing). Put the Huffman tree already in memory in an intuitive way
(tree or concave table form) is displayed on the terminal, and the Huffman tree in this character form is written to the file
treeprint.
3. Implementation prompts
According to the requirements of the subject, the program is divided into 5 modules, designed as a menu, and each time a module is executed, it
returns to the menu.
Except for the initialization (I) process, the disk file data is read once in each execution. This is
so if the initialization (I) process has not been carried out after the program is executed, in order to enable the subsequent operations
to proceed smoothly, the work can be performed by reading the old data. For example, if the character set and
25/43
weight data required for the program's work are fixed, it is only necessary to perform an initial (I) operation when the program is installed. When
the program is run again, no matter what operation is performed, the required data can be read into the memory.
4. Algorithm Analysis
This program mainly uses three algorithms.
(1) Huffman coding In the process of initialization (I), a
Huffman and the Huffman coding is obtained. First, store the input characters and weights in a structure array, build a
Huffman tree, and store the calculated Huffman code in another structure array.
(2) Matching of strings In the process of encoding (D), to decode the already encoded code, a
loop can be used to compare the string with the same length as the Huffman encoding in the code with the Huffman encoding. , if
equal , echo and save to file.
(3) Traversal of the binary tree In the Huffman tree (T), because the Huffman tree is also a binary tree, it is
necessary to use the preorder traversal of the binary tree to output the Huffman tree.
5. Test Data
According to the experimental requirements, enter "THIS PROGRAM IS MY FAVORITE" in tobetrans.dat, the
character set and its frequency are as follows: ("--" means space)
character -- ABCDEFGHIJKLM
frequency 186 64 23 22 32 103 21 15 47 57 1 5 32 20
characters NOPQRSTUVWXYZ
frequency 20 56 19 2 50 51 55 30 10 11 2 21 2
http://www.6daixie.com/contents/14/1354.html

The core members of the team mainly include Silicon Valley engineers, BAT front-line engineers, top 5 master and doctoral students in China, and are proficient in German and English! Our main business scope is to do programming assignments, course design and so on.

 

Our field of direction: window programming, numerical algorithm, AI, artificial intelligence, financial statistics, econometric analysis, big data, network programming, WEB programming, communication programming, game programming, multimedia linux, plug-in programming program, API, image processing, embedded/MCU database programming, console process and thread, network security, assembly language hardware Programming software design engineering standards and regulations. The ghostwriting and ghostwriting programming languages ​​or tools include but are not limited to the following:

C/C++/C# ghostwriting

Java ghostwriting

IT ghostwriting

Python ghostwriting

Tutored programming assignments

Matlab ghostwriting

Haskell ghostwriting

Processing ghostwriting

Building a Linux environment

Rust ghostwriting

Data Structure Assginment

MIPS ghostwriting

Machine Learning homework ghostwriting

Oracle/SQL/PostgreSQL/Pig database ghostwriting/doing/coaching

web development, website development, website work

ASP.NET website development

Finance Insurance Statistics Statistics, Regression, Iteration

Prolog ghostwriting

Computer Computational method

 

Because professional, so trustworthy. If necessary, please add QQ: 99515681 or email: [email protected]

WeChat: codinghelp

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325213611&siteId=291194637