private static void PrefixCodes(HuffmanNode Node, string Route) { if (Node.IsLeaf()) { CharacterTable.Add(Node.Fact, Route); } else { if (Node.LeftNode != null) { PrefixCodes(Node.LeftNode, Route + "0"); } if (Node.RightNode != null) { PrefixCodes(Node.RightNode, Route + "1"); } } }
private static void PrefixCodes(HuffmanNode Node, string traversal) { if (Node.IsLeaf()) { CharacterTable.Add(traversal, Node.Fact); return; } else { if (Node.LeftNode != null) { PrefixCodes(Node.LeftNode, traversal + "0"); } if (Node.RightNode != null) { PrefixCodes(Node.RightNode, traversal + "1"); } } }