辅导Huffman code 、辅导python Huffman code 代码
讲解R语言编程|讲解R语言编程
Encoder (Compression)
? Write a program that constructs a Huffman code for a given text and encode it.
? Specify your assumptions, data structure used in the implementation.
? Your program should prompt the user to enter the names of the text file and compressed file. Figure 1 shows a sample of the output where the user’s inputs are printed in bold.
Figure 1
? Hint: You may implement the Huffman’s encoder based on the following steps:
o Build a frequency chart for all characters in your text. o Build a Huffman tree. o Make a list of all codewords. o Encode your text using the list of codewords.
Decoder (Decompression)
? Write a program for decoding a text which has been encoded with a Huffman code.
? Specify your assumptions, data structure used in the implementation.
? Your program should prompt the user to enter the names of the compressed file and decoded text file. Figure 2 shows a sample of the output where the user’s inputs are printed in bold.
- QQ:99515681
- 邮箱:99515681@qq.com
- 工作时间:8:00-21:00
- 微信:codinghelp
联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!