huffmanstruct HNode // 静态三叉链表结点类型 { int weight; int parent; int LChild; int RChild; }; struct HCode // 哈夫曼编码表 { char data; char code[100]; }; class Huffman{ private: HNode* HTree; HCode* HCodeTable; protected: // 选取权值最小的两个结点(x,y为游标) void SelectMin(int&x,int&y,int start,int NodeNum); // ! void Reverse(char *); // ! 字符串逆序:"abc"->"cba" public: void CreateHTree(int a[],int n); void CreateCodeTable(char b[],int n); void Encode(char *s, char *d); // ! void Decode(char *s, char *d,int n); ~Huffman(){} };