public void setCodeToTheTree(string code, HuffmanNode Nodes) { if (Nodes == null) { return; } if (Nodes.leftNode == null && Nodes.rightNode == null) { Nodes.code = code; return; } setCodeToTheTree(code + "0", Nodes.leftNode); setCodeToTheTree(code + "1", Nodes.rightNode); }