文件名称:c
-
所属分类:
- 标签属性:
- 上传时间:2014-08-11
-
文件大小:2.51kb
-
已下载:0次
-
提 供 者:
-
相关连接:无下载说明:别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容来自于网络,使用问题请自行百度
本次试验的主要要点是哈夫曼树的建立过程,这种算法的思路是:
1)依据给定的n个权值{W0,W1,……,Wn-1}构造n棵只有一个根结点的二叉树,这些二叉树组成一个森林F={T0,T1,……,Tn-1}。
2)在森林F中选取两棵根结点的权值最小的二叉树作为左、右子树合并成一棵新的二叉树,这棵新的二叉树的根结点的权值等于其左、右子树根结点的权值之和。这样一来,森林中就减少了一棵树。
3)重复上一步,直到森林F中只有一棵二叉树为止,这棵二叉树便是要得到的哈夫曼树
二叉树建立好之后,通过创建文件分静态存储和动态存储方式来存储数据,通过显示文件中的数据来查看是否数据以存储到文件中,哈夫曼树中所有左分支表示0,所有右分支表示1,把依据从根结点到每个叶子节点所经过的分支而组成的二进制位的序列作为该叶子对应字符的编码,输入编码通过与以编号的代码比对输出字符。
-The main points of this trial is the process of establishing the Huffman tree, this algorithm is the idea of:
1) based on N weights given by {W0, W1,...... The Wn-1} structure, n tree has only one root node of the two fork tree, the two tree into a forest F={T0, T1,...... , Tn-1}.
2) in the forest F as left, right subtree merge into a new two fork tree selection two tree root node of the minimum weight of two binary tree, and the weight of the root node of the tree the new two fork tree weights equal to the left, the right sub tree nodes. As a result, the forest was reduced to a tree.
3) repeat the previous step, until the forest F only a two binary tree, the two binary tree is to get the Huffman tree
After the two fork tree establishment, to store the data by creating a file is divided into static and dynamic storage mode, by displaying the data in the file to check if the data is stored in the file, the Huffman tree in the left branch said all 0, all right branch 1, branch based
1)依据给定的n个权值{W0,W1,……,Wn-1}构造n棵只有一个根结点的二叉树,这些二叉树组成一个森林F={T0,T1,……,Tn-1}。
2)在森林F中选取两棵根结点的权值最小的二叉树作为左、右子树合并成一棵新的二叉树,这棵新的二叉树的根结点的权值等于其左、右子树根结点的权值之和。这样一来,森林中就减少了一棵树。
3)重复上一步,直到森林F中只有一棵二叉树为止,这棵二叉树便是要得到的哈夫曼树
二叉树建立好之后,通过创建文件分静态存储和动态存储方式来存储数据,通过显示文件中的数据来查看是否数据以存储到文件中,哈夫曼树中所有左分支表示0,所有右分支表示1,把依据从根结点到每个叶子节点所经过的分支而组成的二进制位的序列作为该叶子对应字符的编码,输入编码通过与以编号的代码比对输出字符。
-The main points of this trial is the process of establishing the Huffman tree, this algorithm is the idea of:
1) based on N weights given by {W0, W1,...... The Wn-1} structure, n tree has only one root node of the two fork tree, the two tree into a forest F={T0, T1,...... , Tn-1}.
2) in the forest F as left, right subtree merge into a new two fork tree selection two tree root node of the minimum weight of two binary tree, and the weight of the root node of the tree the new two fork tree weights equal to the left, the right sub tree nodes. As a result, the forest was reduced to a tree.
3) repeat the previous step, until the forest F only a two binary tree, the two binary tree is to get the Huffman tree
After the two fork tree establishment, to store the data by creating a file is divided into static and dynamic storage mode, by displaying the data in the file to check if the data is stored in the file, the Huffman tree in the left branch said all 0, all right branch 1, branch based
(系统自动生成,下载前可以参看下载内容)
下载文件列表
c.txt
本网站为编程资源及源代码搜集、介绍的搜索网站,版权归原作者所有! 粤ICP备11031372号
1999-2046 搜珍网 All Rights Reserved.