You are viewing a single comment's thread. Return to all comments →
void decode(String s, Node root) { String decoded = ""; Node current = root; for(int i = 0; i<s.length(); i++) { if(s.charAt(i) == '0') current = current.left; else current = current.right; if(current.left == null && current.right == null) { decoded += (current.data +""); current = root; } } System.out.println(decoded); }
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 →