We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
// C++ versionstringss;intidx;intlen;voidCheckNode(node*root){if(root->data>0){std::cout<<root->data;return;}if(ss[idx++]=='0'){CheckNode(root->left);}else{CheckNode(root->right);}}voiddecode_huff(node*root,strings){if(root==nullptr)return;ss=s;len=ss.length();idx=0;while(idx<len){CheckNode(root);}std::cout<<'\n';}
Cookie support is required to access HackerRank
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 →