private void AddBitToCode(HuffmanNode node, bool isLeft) { bool bitToAdd = !isLeft; foreach (int symbol in node.Symbols) { if (this.Codes.ContainsKey(symbol)) { this.Codes[symbol].Insert(0, bitToAdd); } else { this.Codes[symbol] = new List <bool> { bitToAdd } }; } }
public static int CompareNodes(HuffmanNode left, HuffmanNode right) { return(left.Count.CompareTo(right.Count)); }