You are viewing a single comment's thread. Return to all comments →
C++ 14 solution:
void decode_huff(node * root, string s) { if(root == NULL || s.empty() || s == ""){ cout<<""; return; } auto temp = root; for(auto c : s){ temp = c == '0' ? temp->left : temp->right; if(temp && temp->data){ cout<<temp->data; temp = 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++ 14 solution: