public void PrintfLeafAndCodes(HuffmanNode nodeList, Dictionary <int, string> prefCodes) { if (nodeList == null) { return; } if (nodeList.leftTree == null && nodeList.rightTree == null) { //Console.WriteLine("Symbol : {0} - Code : {1}", nodeList.symbol, nodeList.code); prefCodes.Add(Convert.ToInt32(nodeList.symbol), nodeList.code); return; } PrintfLeafAndCodes(nodeList.leftTree, prefCodes); PrintfLeafAndCodes(nodeList.rightTree, prefCodes); }