文件名称:Haffman Tree
文件大小:12KB
文件格式:DOCX
更新时间:2018-07-31 18:10:03
哈夫曼树
const int len = 5; struct Node { int tag; int data; Node* left; Node* right; Node* parent; }; int main() { Node* child[2]; int data[] = {1,2,3,4,5}; Node* a = new Node[2 * len - 1]; for (int i = 0; i < len; i++) { a[i].data = data[i]; a[i].tag = 0; a[i].left = nullptr; a[i].right = nullptr; a[i].parent = nullptr; }