提交 8ab46593 创建 作者: 宋海霞's avatar 宋海霞

modify

上级 a56ce2a9
...@@ -3,45 +3,45 @@ ...@@ -3,45 +3,45 @@
// //
// 在此处包含 C 标准库头文件 // Include the C standard library header file here
// //
#include <stdio.h> #include <stdio.h>
// //
// 在此处包含其他头文件 // Other header files are included here
// //
// //
// 在此处定义数据结构 // Define the data structure here
// //
#define MAXVALUE 1000 // 定义最大权值 #define MAXVALUE 1000 // Define the maximum value
// 节点的结构 // Node structure
typedef struct HtNode{ typedef struct HtNode{
int Weight; // 节点权值 int Weight; // The node weight
int parent, lchild, rchild; // 父节点和左右孩子在数组中的下标 int parent, lchild, rchild; // The parent and the left and right child are subscripts in the array
}HtNode; }HtNode;
// 哈夫曼树的结构 // The structure of a Huffman tree
typedef struct _HtTree{ typedef struct _HtTree{
int Count; // 叶子节点的个数 int Count; // Number of leaf nodes
int Root; // 哈夫曼根节点在数组中的下标 int Root; // The index of the Huffman root node in the array
struct HtNode *HtArray; // 存放 2*Count-1 个节点的数组 struct HtNode *HtArray; // The subscript of the Huffman root in an array of 2*Count-1 nodes
}HtTree, *PHtTree; }HtTree, *PHtTree;
// //
// 在此处声明函数 // Declare the function here
// //
PHtTree HuffmanTree(PHtTree pTree, int Count); // 哈夫曼树的构造函数 PHtTree HuffmanTree(PHtTree pTree, int Count); // The constructor for the Huffman tree
void OutputResult(PHtTree pTree, int Length); void OutputResult(PHtTree pTree, int Length);
// //
// 在此处声明全局变量 // Declare global variables here
// //
#endif /* _HUFFMANTREE_H_ */ #endif /* _HUFFMANTREE_H_ */
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论