public static string Walk(PatriciaTrieNode node, int level) { if (node == null) { return(string.Empty); } var result = new StringBuilder(); result.Append($"<'{node.Key}'"); if (node.Value.HasValue) { result.Append($" {node.Value}"); } result.Append(">"); foreach (var child in node.Childs) { result.Append("\n"); for (var i = 0; i < level; i++) { result.Append("\t"); } result.Append(Walk(child.Value, level + 1)); } return(result.ToString()); }
public static string Walk(PatriciaTrieNode node, int level) { if (node == null) return string.Empty; var result = new StringBuilder(); result.Append($"<'{node.Key}'"); if (node.Value.HasValue) result.Append($" {node.Value}"); result.Append(">"); foreach (var child in node.Childs) { result.Append("\n"); for (var i = 0; i < level; i++) { result.Append("\t"); } result.Append(Walk(child.Value, level+1)); } return result.ToString(); }
public PatriciaTrie() { Root = new PatriciaTrieNode(""); }