请教信息技术的高手!悬赏100!
来源:百度知道 编辑:UC知道 时间:2024/06/22 21:54:05
要的是答案不是废话!!要的是答案不是废话!!要的是答案不是废话!
A good beginning is half done.
要C还是C++还是JAVA????
网上找到一个代码.看了一下.还比较符你的要求.供你参考.
#include <string.h>
#include <stdio.h>
#define MAX_NODE 1024
#define MAX_WEIGHT 4096
typedef struct HaffmanTreeNode {
char ch, code[15];
int weight;
int parent, lchild, rchild;
} HTNode, *HaTree;
typedef struct {
HTNode arr[MAX_NODE];
int total;
} HTree;
/* 统计字符出现的频率 */
int statistic_char(char *text, HTree *t){
int i, j;
int text_len = strlen(text);
t->total = 0;
for (i=0; i<text_len; i++) {