#include #include #include "config.h" #include "Huffman.h" HTree *Coder(PriorityList * P) { int n = P->n(), i, f1, f2; HTree *x, *y, *z; Datas_t tx, ty; x = y = z = NULL; for (i = 0; i < n - 1; i++) { f1 = P->Extract_Min(tx); f2 = P->Extract_Min(ty); x = (HTree *) tx; y = (HTree *) ty; z = new HTree(x, y); P->Insert(z->ReadFreq(), z); } P->Extract_Min(((Datas_t) z)); return z; } void HInsert(PriorityList * P, int freq, char *object) { HTree * leaf = new HTree(freq, object); P->Insert(freq, (Datas_t) leaf); }