#pragma once
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define n 10
#define m (2*n-1)
char c[n] = {
'a','b','c', 'd', 'e', 'f', 'g', 'h', 'i', 'j' };
int times[n] = {
10,9,5,8,2,4,1,4,6,2 };
typedef struct huffman_tree {
char ch;
int left, right, parent;
int weight;
}tree;
tree t[m],*tmp=t;
void init_parent(int par, int _m) {
int min = -1;
for (int i = 0; i < par; i++) {
if (t[i].parent != -1 || t[i].weight == 0) {
continue;
}
if (min == -
c语言-哈夫曼编码
于 2022-08-17 10:58:13 首次发布