private int Partition(List <Inf> array, int StartPosition, int EndPosition) { int i = StartPosition; for (int j = StartPosition; j <= EndPosition; j++) { if (array[j].frequency >= array[EndPosition].frequency) { Inf t = array[i]; array[i] = array[j]; array[j] = t; i++; } } return(i - 1); }
private void GetInfList(List <char> SymbolList) { Node <char, Inf> node; Inf inf; foreach (var cur in SymbolList) { node = new Node <char, Inf>(); inf = new Inf(); node = CodeTree.Find(cur); inf.symbol = node.Key; inf.frequency = node.Data.frequency; InfList.Add(inf); } }
private void GetSymbolsTree(char[] UserString) { Inf curInf; for (int i = 0; i < UserString.Length; i++) { curInf = new Inf(); curInf.frequency = 1; try { curInf.symbol = UserString[i]; CodeTree.Insert(UserString[i], curInf); } catch { CodeTree.Find(UserString[i]).Data.frequency++; } } }