文件名称:综合实验哈夫曼编码
介绍说明--下载内容均来自于网络,请自行研究使用
1.n个叶结点,权分别为w1,w2,• • • ,wn的二叉树中,带权路径长度WPL最小的二叉树叫最优二叉树, 也叫霍夫曼树。
2.霍夫曼算法:1)根据给定的权值{w1,w2,• • • ,wn}构造n个二叉树F={T1,T2,• • • ,Tn}每个Ti只有一个根结点,权为wi。2)在F中选取两棵根结点的权值最小的树 构成一棵新的二叉树,其根的权值为左右子树根的权值的和。3)F中删去这两棵树,加上新得的树。4)重复2)3)直到只剩一棵树。
-1. N leaf nodes, the right to w1, w2,# 8226# 8226, wn the binary tree, with the right path length WPL smallest binary tree called Optimal binary tree, the tree is also called Hoffman. 2. Hoffman algorithm : 1) According to the weights (w1, w2,# 8226# 8226# 8226, wn) n binary tree structure F = (T1, T2,# 8226# 8226# 8226, Tn) each only a Ti Root, the right to wi. 2) In 1984 two F Root in the value of the right to the smallest tree constitute a new binary tree, the roots of the right value for the son around the roots and the value of the right. 3) F deleted these two trees, coupled with the new tree. 4) repeat 2) 3) until only a tree.
2.霍夫曼算法:1)根据给定的权值{w1,w2,• • • ,wn}构造n个二叉树F={T1,T2,• • • ,Tn}每个Ti只有一个根结点,权为wi。2)在F中选取两棵根结点的权值最小的树 构成一棵新的二叉树,其根的权值为左右子树根的权值的和。3)F中删去这两棵树,加上新得的树。4)重复2)3)直到只剩一棵树。
-1. N leaf nodes, the right to w1, w2,# 8226# 8226, wn the binary tree, with the right path length WPL smallest binary tree called Optimal binary tree, the tree is also called Hoffman. 2. Hoffman algorithm : 1) According to the weights (w1, w2,# 8226# 8226# 8226, wn) n binary tree structure F = (T1, T2,# 8226# 8226# 8226, Tn) each only a Ti Root, the right to wi. 2) In 1984 two F Root in the value of the right to the smallest tree constitute a new binary tree, the roots of the right value for the son around the roots and the value of the right. 3) F deleted these two trees, coupled with the new tree. 4) repeat 2) 3) until only a tree.
(系统自动生成,下载前可以参看下载内容)
下载文件列表
综合实验哈夫曼编码.cpp