ImageVerifierCode 换一换
格式:DOCX , 页数:13 ,大小:190.94KB ,
资源ID:10317740      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/10317740.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(p2document.docx)为本站会员(b****7)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

p2document.docx

1、p2documentProject 2-Huffman Codes-By Group 06 2008.12-10IndexChapter 1: Introduction. . . . .-1.4 Steps to run the programChapter 2: Algorithms Specification. - 2.1 Data Structures2.2 AlgorithmsChapter 3: Testing Results. Chapter 4: Analysis and Comments. - 4.14.2 some Further Comments 4.3time compl

2、exity & space complexity4.4 Further Improvements Appendix I: Source Code (in C) . A. Mian function of the project.B. Test generate function for tester.Appendix II:Duty Assignments.Chapter 1: IntroductionProblem Description:In 1953, David A. Huffman published his paper “A Method for the Construction

3、of Minimum-Redundancy Codes”, and hence printed his name in the history of computer science. As a professor who gives the final exam problem on Huffman codes, I am encountering a big problem: the Huffman codes are NOT unique. For example, given a string “aaaxuaxz”, we can observe that the frequencie

4、s of the characters a, x, u and z are 4, 2, 1 and 1, respectively. We may either encode the symbols as a=0, x=10, u=110, z=111, or in another way as a=1, x=01, u=001, z=000, both compress the string into 14 bits. Another set of code can be given as a=0, x=11, u=100, z=101, but a=0, x=01, u=011, z=00

5、1 is NOT correct since “aaaxuaxz” and “aazuaxax” can both be decoded from the code 00001011001001. The students are submitting all kinds of codes, and I need a computer program to help me determine which ones are correct and which ones are not.Our purpose is to judge whether the submission of the st

6、udents is Huffman code or not.First we should mention that the code that genetared by the huffman algorithm is unique cause the nodes will be sorted before creating the tree, while ,generally, Huffman code is not unique ,just because unsoted nodes have many sequences.It will be an important point wh

7、ile considering the algorithm. You will see more details in the next chapter :Algorithms Specification.Background:About David A. Huffman(August 9, 1925 October 7, 1999):David A. Huffman was a pioneer in the computer science field. Throughout his life, Huffman made many important contributions to the

8、 study of finite state machines, switching circuits, synthesis procedures, and signal designs etc. However, David Huffman is best known for his legendary “Huffman code”, which we will study in this project, a compression scheme for lossless variable length encoding. It was the result of a term paper

9、 he wrote while a graduate student at the Massachusetts Institute of Technology (MIT), where he earned a ScD degree on a thesis named The Synthesis of Sequential Switching Circuits, advised by Samuel H. Caldwell (1953).1Huffman Codes are widely used in nearly every application that involves the comp

10、ression and transmission of digital data, such as fax machines, modems, computer networks, and high-definition television (HDTV), which is widely used in modern society.About Huffman code:Chapter 2: Algorithm SpecificationData Structures:Main Data Structure for a HuffmanTree TreeNode:typedef struct

11、unsigned int weight; unsigned int parent,lchild,rchild; HTNode; Algorithms:1.First, bulid the Huffman tree:for(i=n+1;i=m;+i) select(*HT,i-1,&s1,&s2);/* select the two smallest node whose parent is zero from HT1 to HTi-1 */ (*HT)s1.parent=(*HT)s2.parent=i; (*HT)i.lchild=s1; (*HT)i.rchild=s2; (*HT)i.w

12、eight=(*HT)s1.weight+(*HT)s2.weight; Buliding method Huffman tree:1.choose the smallest two number of the array, assigh its parent pointer to i;2.assigh its weight right after that.Then do it repeatedly.so we got the Huffman tree.Now illustrating it:Do it by upper method repeadly:Do it by upper meth

13、od repeadly:Final state:Now we got Huffman tree!2.Then we calculate the WPL of the standard Huffman tree. for(i=1;i=n;i+) WPL=WPL+wi-1*strlen(HCi);/*calculate to get the value of WPL*/ 3. Calculate the WPL of the input submissions.sum=0;/*initialization sum*/for(i=0;in;i+) scanf(%s,&c); getchar(); g

14、ets(stringi); sum=sum+wi*strlen(stringi);/*the total length of code needed to determine*/4.Compare WPL and WPL If them are equal input case right.Else check whether input case have the relationship of prefixionif(sum!=WPL)/*if sum not equals WPL, then we can say no immediately*/ printf(Non); else/*i

15、f not, we need to look whether they have the relationship of prefixion*/ for(k=0;kn;k+) for(i=k+1;in;i+) l=strlen(stringk); if(strlen(stringi)WPL=864,so it is not the Huffman code.so printf No!To conclude: Testing of these set of testcases are all right.B .Large Scale testdatain this test I provide

16、some testcase that are generated by program ,so that test whether the non-prifix judging is right or not.I just change the sample input .Input cases:Chapter 4: Analysis and CommentsTime complexity & space complexity AnalysisSome Further Comments Further improvement:A.About algorithm:This algorithm f

17、irst need to create an Huffman tree to calculate the smallest WPL of certain input characters, and then it calculate the input WPL,and compare them. I mean calculating WPL by creating a Huffman tree will be costy.It can be improved using another algorithm,while it is really difficult to write.If tim

18、e permit it will be a potential breakthrough point in this programme. B.About Others:1.The user interface of the program can be more friendly.2.The overall style of the document can be smarter.3.Our group wrking can be more efficient.Appendix I: Source Code (in C)Appendix II: Duty AssignmentsProgrammer 王园园 3072211113Tester 王迪 3079901015Report Writer 郭宇波 3079901016

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1