首页|一种层级统计获取带权路径长度算法

一种层级统计获取带权路径长度算法

扫码查看
哈夫曼二叉树是一种最优二叉树,它是带权路径长度最短的二叉树.为了使二叉树的带权路径长度达到最小,在构建哈夫曼树时需要遵循一个原则:权重越大的结点离树根越近.因此,每次需要根据各个结点的权重值筛选出其中值最小的两个结点,然后构建二叉树.构建二叉树有一定的规则,但是要确定是否最优二叉树,则必须通过计算其WPL值才能判断.因此,需要设计一个专门计算WPL的算法,用以检验二叉树带权路径长度的最小值.本文采用层级统计算法通过前序遍历搜索带有权值的叶子结点来获得WPL值,为构建哈夫曼树提供依据.
A Hierarchical Statistical Algorithm for Obtaining Weighted Path Length
The huffman binary tree is an optimal binary tree,which is the shortest binary tree with weight path length.In order to minimize the weighted path length of a binary tree,a principle should be followed when con-structing a Huffman tree,that is,the node with greater weight is closer to the root of the tree.Therefore,each time we need to filter out the two nodes with the smallest value according to the weight value of each node,and then build a binary tree.There are certain rules for constructing a binary tree,but to determine whether it is the optimal binary tree,it must be determined by calculating its WPL value.Therefore,it is necessary to design a special algo-rithm to calculate WPL to test which is the minimum value of the weighted path length of the binary tree.In this pa-per,the hierarchical statistical algorithm is used to search the leaf node with weight by preorder traversal to obtain the WPL value,which provides the basis for the construction of Huffman tree.

weighted pathhierarchical statisticsalgorithm

周铜、许爽

展开 >

郑州科技学院,河南 郑州450064

郑州工程技术学院,河南 郑州450044

带权路径 层级统计 算法

2024

中州大学学报
中州大学

中州大学学报

CHSSCD
影响因子:0.233
ISSN:1008-3715
年,卷(期):2024.41(6)