#include#include #define leafNumber 20 //默认权值集合大小 #define totalNumber 39 //数结点个数=2*leafNumber-1 typedef struct { char data; //结点的值 int weight; //结点的权 int Parent,lchild,rchild; //双亲、左、右子女结点指针 }HTNode;typedef struct { char elem[totalNumber]; //Huffman树存储数组 int num; //num是外结点数,root是根 }HFTree;//算法void createHFTree (HTNode HT[],HFTree HElem[],char value[],int fr[],int n){ //输入数据value[n]和相应权值fr[n],构造用三叉链表表示的Huffman树HT for(int i = 0;i %d):",leafNumber); scanf("%d",&n); if(n>leafNumber||n<1) return 1; char a[n]; for(int i = 0;i