文件名称:huffmancode-0.1
-
所属分类:
- 标签属性:
- 上传时间:2013-03-16
-
文件大小:2.88kb
-
已下载:0次
-
提 供 者:
-
相关连接:无下载说明:别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容来自于网络,使用问题请自行百度
构造霍夫曼树 //////////////////////
//根据权重生成霍夫曼树
//weight 权重数组
//n 权重数组长度
//NewTree 新生成的霍夫曼树
void createHFMTree(int* weights,int n,BinaryTree<int>& NewTree)
{
//初始化堆
MinHeap<BinaryTree<int> > heap(n)
int i=0
for( i<n i++){
heap.Insert(BinaryTree<int>(weights[i]))
}
//选择堆中根数值较小的两棵树,组成一棵新树然后插入堆里,并把原来的两棵树从堆里删除-Construct the Huffman tree//////////////////////// to generate Huffman tree// weight weights array// n weights array length// NewTree weight new Huffman tree generated void createHFMTree (int* weights, int n, BinaryTree <int> & NewTree) {//initialize heap MinHeap <BinaryTree<int> > Heap (n) int i = 0 for ( i <n i++){
heap.Insert(BinaryTree<int> (Weights [i])) }// Select heap root smaller value of the two trees, and then inserted into the pile to form a new tree and two trees removed from the pile
//根据权重生成霍夫曼树
//weight 权重数组
//n 权重数组长度
//NewTree 新生成的霍夫曼树
void createHFMTree(int* weights,int n,BinaryTree<int>& NewTree)
{
//初始化堆
MinHeap<BinaryTree<int> > heap(n)
int i=0
for( i<n i++){
heap.Insert(BinaryTree<int>(weights[i]))
}
//选择堆中根数值较小的两棵树,组成一棵新树然后插入堆里,并把原来的两棵树从堆里删除-Construct the Huffman tree//////////////////////// to generate Huffman tree// weight weights array// n weights array length// NewTree weight new Huffman tree generated void createHFMTree (int* weights, int n, BinaryTree <int> & NewTree) {//initialize heap MinHeap <BinaryTree<int> > Heap (n) int i = 0 for ( i <n i++){
heap.Insert(BinaryTree<int> (Weights [i])) }// Select heap root smaller value of the two trees, and then inserted into the pile to form a new tree and two trees removed from the pile
(系统自动生成,下载前可以参看下载内容)
下载文件列表
huffmancode.c
本网站为编程资源及源代码搜集、介绍的搜索网站,版权归原作者所有! 粤ICP备11031372号
1999-2046 搜珍网 All Rights Reserved.