废话不多说直接看代码,有什么对于哈夫曼树的疑问直接去百度就行了,这里就不啰嗦了:
#include#define N 5 #define M 2*N-1 typedef struct huffmantree { int weight; int parent; int lchild; int rchild; int ownplase; //每个带权值的节点的位置// }huffmantree; //一般清空下,第0号元素不用// void Inittree(huffmantree T[]) //初始化全部值赋值为0// { for(int i=0;i 给大家加一个例子:
question:Please input 5 trees with weights(5.7.3.2.8) from the keyboard and print huffman table。



