typedef struct TreeNode *HuffmanTree;
struct TreeNode {
int Weight;
HuffmanTree Left, Right;
};
HuffmanTree Huffman(MinHeap H) {
BulidMinHeap(H);
for (int i = 1; i < H->Size; ++ i) {
HuffmanTree T = (HuffmanTree)malloc(sizeof(struct TreeNode));
T->Left = DeleteMin(H);
T->Right = DeleteMin(H);
T->Weight = T->Left->Weight + T->Right->Weight;
Insert(H, T);
}
return DeleteMin(H);
}
标签:Right,TreeNode,哈夫曼,Weight,DeleteMin,HuffmanTree,struct
From: https://www.cnblogs.com/shenpengfii/p/16943119.html