You are viewing a single comment's thread. Return to all comments →
void decode(String s, Node root) { String word = ""; Node location = root; for(char i: s.toCharArray()){ if(i == '0'){ if (location.left.left ==null){ word+=location.left.data; location = root; }else{ location = location.left; } } else if(i=='1'){ if (location.right.right ==null){ word+=location.right.data; location = root; }else{ location = location.right; } } } System.out.print(word);
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 →