示例#1
0
        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));
        }
示例#2
0
 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);
         }
     }
 }