(HuffmanNode root, String s)
| 20 | // Implementing the huffman algorithm |
| 21 | public class Huffman { |
| 22 | public static void printCode(HuffmanNode root, String s) { |
| 23 | if (root.left == null && root.right == null && Character.isLetter(root.c)) { |
| 24 | |
| 25 | System.out.println(root.c + " | " + s); |
| 26 | |
| 27 | return; |
| 28 | } |
| 29 | printCode(root.left, s + "0"); |
| 30 | printCode(root.right, s + "1"); |
| 31 | } |
| 32 | |
| 33 | public static void main(String[] args) { |
| 34 |