public static IEnumerable <BSTNode <string, string> > GetAllStartWith(this DuplicableSimpleBSTree <string, string> tree, char letter) { if (tree == null) { throw new ArgumentNullException("Tree is null"); } return(tree.BFS().Distinct().Where(node => node.Key[0] == letter)); }
public static void WriteText(this DuplicableSimpleBSTree <string, string> tree, Stream stream) { using (var writer = new StreamWriter(stream)) { foreach (var item in tree.BFS()) { writer.WriteLine(item.Value); } } }