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