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.
void decode_huff(node * root,string s)
{
node*ptr=root;
int i=0;
char c;
while(idata=='\0'){
c=s.at(i++);
//cout<left;
else ptr=ptr->right;
}
cout<data;
ptr=root;
}
}
here is my code in C++.
you are only checking on left and right side child of root for leaf node.
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 →
void decode_huff(node * root,string s) { node*ptr=root; int i=0; char c; while(idata=='\0'){ c=s.at(i++); //cout<left; else ptr=ptr->right; } cout<data; ptr=root; } } here is my code in C++. you are only checking on left and right side child of root for leaf node.