#include "stdafx.h"
#include <stdio.h>
#include <stdlib.h>
#define debug 0
typedef struct HuffNode {
int parent;
int lchild;
int rchild;
int wet;
}*HuffTree, HNode;//树的节点
/**/
int Weight_min(HuffTree HT, int k);
int SelectTwoMinNode(HuffTree HT, int k, int &min1, int &min2);
HuffTree CreatHuffmanTree(HuffTree HT, int *wet, int amount);
void Test(HuffTree HT, int amount);
void ReverseRight(HuffTree HT, HuffTree Head);
void HuffManEncode(HuffTree HT, int amount);
int main()
{
printf("请输入创建的节点个数:");/*创建的节点在哈夫曼编码中都是叶子节点*/
int amount;
scanf_s("%d", &amount);
int *wet = (int*)malloc(amount * sizeof(int));
//对权赋值;可以自己手动输入特定权值
for (int i = 0; i < amount; i++) {
*(wet + i) = i+10;
}
HuffTree HT = NULL;//对于指针一定要赋初值
HT = CreatHuffmanTree(HT,wet,amount);
Test(HT, amount);
HuffTree