c
flex 

所属分类:数据结构
开发工具:Flex
文件大小:3KB
下载次数:5
上传日期:2014-08-11 15:56:23
上 传 者昵称----
说明:  本次试验的主要要点是哈夫曼树的建立过程,这种算法的思路是: 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 (11887, 2014-08-11)

近期下载者

相关文件


收藏者