- 1、本文档共43页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 5、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 6、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 7、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 8、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
第10讲 赫夫曼编码
第4章 贪心算法 赫夫曼编码 单源最短路径 Huffman codes Data Compression via Huffman Coding Motivation Limited network bandwidth. Limited disk space. Human codes are used for data compression. Reducing time to transmit large files, and Reducing the space required to store them on disk or tape. Huffman codes are a widely used and very effective technique for compressing data, savings of 20% to 90% are typical, depending on the characteristics of the data. Huffman codes Problem Suppose that you have a file of 100K characters. To keep the example simple, suppose that each character is one of the 6 letters from a through f. Since we have just 6 characters, we need just 3 bits to represent a character, so the file requires 300K bits to store. Can we do better? Suppose that we have more information about the file: the frequency which each character appears. Solution The idea is that we will use a variable length code instead of a fixed length code (3 bits for each character), with fewer bits to store the common characters, and more bits to store the rare characters. Example of Data Compression For example, suppose that the characters appear with the following frequencies, and following codes: Then the variable-length coded version will take not 300K bits but 45*1 + 13*3 + 12*3 + 16*3 + 9*4 + 5*4 = 224K bits to store, a 25% saving. In fact this is the optimal way to encode the 6 characters present, as we shall see. Characteristic of Optimal Code Represented as a binary tree whose leaves are the given characters. In an optimal code each non-leaf node has two children. Prefix-free Code In a Prefix code no codeword is a prefix of another code word. Easy encoding and decoding. To encode, we need only concatenate the codes of consecutive characters in the message. The string 110001001101 parses uniquely as 1100-0-100-1101, which decodes to FACE. To decode, we have to decide where each code begins and ends. Easy, since, no codes share a prefix. Example of Huffman codes Example of Huffman co
您可能关注的文档
最近下载
- 绿色低碳压缩空气站评价导则.docx VIP
- 【B-2】科室对分级护理落实情况进行定期检查,对存在问题有改进措施.docx VIP
- 火龙罐技术课件.ppt VIP
- 施工管理软件:Procore二次开发_(1).Procore基础知识.docx VIP
- 心电图远程会诊流程图-2.pdf VIP
- 沙漠掘金全部课件2王陵风险卡.pptx VIP
- 儒释道的人生智慧.pptx VIP
- 施工管理软件:Procore二次开发_(8).Procore报表与数据分析.docx VIP
- 吉泰科GK800变频器用户手册.pdf
- 安全管理软件:Procore二次开发_(18).Procore部署与上线.docx VIP
文档评论(0)