C++?????????????????????
?????Dmego ???????[ 2016/11/16 10:43:56 ] ????????C++ ????????
78 /*-----------????????---------------------------*/
79 int s1??s2;
80 for (int i = n + 1; i <= m; ++i)
81 {//???n-1?ε?????????????????????????
82 Select(HT?? i - 1?? s1?? s2);
83 /*cout << HT[s1].weight << " ?? " << HT[s2].weight << endl;*/
84 /*??s1??s2?????????0???i
85 (??????????????????????????????????Select()????)*/
86 HT[s1].parent = i;
87 HT[s2].parent = i;
88 //s1????s2??????i?????????
89 HT[i].lchild = s1;
90 HT[i].rchild = s2;
91 //???i?????s1??s2?????
92 HT[i].weight = HT[s1].weight + HT[s2].weight;
93 }
94 }
95
96 //?????????????????????????????????????????HC??
97 void CreatHuffmanCode(HuffmanTree HT?? HuffmanCode &HC?? int n)
98 {
99 HC = new char*[n + 1];//??????n????????????????
100 char *cd = new char[n];//????????洢?????????????
101 cd[n - 1] = '