资 源 简 介
哈夫曼树算法
根据给定的n个权值{w1,w2,……wn},构造n棵只有根结点的二叉树,令起权值为wj
在森林中选取两棵根结点权值最小的树作左右子树,构造一棵新的二叉树,置新二叉树根结点权值为其左右子树根结点权值之和
在森林中删除这两棵树,同时将新得到的二叉树加入森林中
重复上述两步,直到只含一棵树为止,这棵树即哈夫曼树
-Huffman tree algorithm based on a given n-weights (w1, w2, ... ... wn), construct n trees only a root node of the tree, so that from the right value of wj in the forest root node to select two the right tree for the value of the smallest subtree around, a new binary tree structure, the right to buy a new tree root node value of its subtree root node around the right value in the forest and delete these two trees, At the same time, the new binary tree obtained by adding the forest to repeat the above two steps until a tree containing only the date, that is, Huffman tree tree