课程设计报告

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

《数据结构》课程设计报告

设计题目:__哈夫曼树编码译码

姓名:______胡明号___________

学号:______211011008________

专业:_______嵌入式软件______

院系:_计算机科学与技术学院___

班级:________1003____________

指导教师:_____高秀梅_________

2012年 3 月 20 日

摘要

哈夫曼编/译器设计:利用哈夫曼编码进行通信可以大大提高信道利用率,缩短信息传输时间,降低传输成本。但是,这要求这发送端通过一个编码系统对待传数据预先编码,在发送端将传来的数据进行译码(复原)。对于双工信道。每端都需要一个完整的编译码系统。本程序将为这样的信息收发站写一个哈夫曼的编译码系统。

哈夫曼编码/译码程序运行步骤:

字查找,从英文文章中识别出字符,并把字符插入到一棵二叉排序树中。

哈夫曼树中序遍历,是为了把英文文章中的不重复的字符保存起来。

哈夫曼编码,在已经构造好的霍夫曼树中从每个叶子结点出发追溯到树根,逆向找出霍夫曼树中叶子结点的编码,规定:树中每个结点的左分支标上0,右分支标上1。

哈夫曼译码利用霍夫曼树实现对产生的编码文件的译码,译码过程为:从根结点出发,按二进制位串的0或1进入左分支或右分支,当到达叶子结点时译出该叶子对应的单词或标点符号,若该编码文件尚未结束,则回到根结点继续进行上述过程。

运行环境:windows XP 语言环境:简体中文软件大小:51 KB 编写工具: Microsoft Visual studio 2008

Abstract

Information : Huffman coding used in communication can greatly improve the channel utilization, reduced transmission time, and lower transmission costs. However, this requires that the sender through a coding system for pre-treatment data-coding, the transmitter will be sent for decoding data (recovery). For dual-channel. Each side needs a complete encryption system. This procedure will this information hubs Huffman was one of the encryption system.

Hoffmann code for coding procedures to run the steps and :

word from english in the words and punctuation marks;and insert the words, and punctuation marks a second sort of a tree. the traversal order hoffmann, to english articles do not repeat the words and punctuation marks.

Hoffmann tree in order to traverse;keep the code has been constructed in hoffmann good hafman tree leaves from the start dates back to tabulate the roots;

Hoffmann decoding;hafman the implementation of the code to the coding, coding procedures for : from start to tabulate the roots of binary of 0 or 1 to the left or right, a subdivision of a branch is to tabulate the leaves of the leaves translate the words or punctuation marks, if the code file is not finished but is to tabulate the process of continuing. all the code, coding procedures are in the file.

目录

一、问题描述 (4)

二、需求分析 (4)

三、概要设计 (5)

四、数据结构设计 (7)

五、算法设计 (7)

六、程序测试与实现 (9)

七、调试分析 (12)

八、心得体会 (12)

一、问题描述

1、题目内容:

利用哈夫曼编码进行信息通信可以大大提高信道利用率,缩短信息传输时间,降低传输成本。但是,这要求在发送端通过一个编码系统对待传数据预先编码,在接收端将传来的数据进行译码(复原)。试写一个哈夫曼编/译码系统。

2、基本要求:

一个完整的系统应具有以下功能:

(1)初始化。从终端读入字符集大小n,以及n个字符和n个权值,建立哈夫曼树,并将它存于文件中。

(2)编码。利用已建好的哈夫曼树对文件中的正文进行编码,然后将结果存入文件中。

(3)译码。利用已建好的哈夫曼树将文件中的代码进行译码,结果存入文件中。

(4)完成数据测试,要求编码字符不低于15个,编码文件的长度不低于50个字符。

(5) 计算平均编码长度。

二、需求分析

一个完整的系统应具有以下功能:

1、初始化(Initialization)。从终端读入字符集大小n,以及n个

相关文档
最新文档