0001 void decode(HuffTree& tree, Bitmap& code, int n) { //根据编码树对长为n的Bitmap串做Huffman解码 0002 BNP<HuffChar> x = tree.root(); 0003 for (int i = 0; i < n; i++) { 0004 x = code.test(i) ? x->rc : x->lc; 0005 if (IsLeaf(x)) { printf("%c", x->data.ch); x = tree.root(); } 0006 } 0007 } //解出的明码,在此直接打印输出;实用中可改为根据需要返回上层调用者