文件名称:huffmancode-0.1
介绍说明--下载内容均来自于网络,请自行研究使用
构造霍夫曼树 //////////////////////
//根据权重生成霍夫曼树
//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