联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-23:00
  • 微信:codinghelp

您当前位置:首页 >> Python编程Python编程

日期:2018-08-05 03:16


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.



版权所有:留学生编程辅导网 2020 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp