MCPcopy Create free account
hub / github.com/PrajaktaSathe/Java / printCode

Method printCode

Programs/HuffmanCoding.java:22–31  ·  view source on GitHub ↗
(HuffmanNode root, String s)

Source from the content-addressed store, hash-verified

20// Implementing the huffman algorithm
21public 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

Callers 1

mainMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected