You are viewing a single comment's thread. Return to all comments →
C++ solution :
void decode_huff(node * root, string s) { int index=0; char ch; node* ptr=root; while(index!=s.size()) { ch=s[index++]; ptr=((ch=='1')?ptr->right:ptr->left); if (ptr->data) { cout << ptr->data; ptr=root; } } }
Seems like cookies are disabled on this browser, please enable them to open this website
Tree: Huffman Decoding
You are viewing a single comment's thread. Return to all comments →
C++ solution :