public static void Read()
        {
            IBinaryTree <string> tree = new Tree.BinaryTree <string>();
            string input = string.Empty;

            while (!input.Equals("quit", StringComparison.CurrentCultureIgnoreCase))
            {
                Console.Write("> ");
                input = Console.ReadLine();

                string[] words = input.Split(new[] { ' ' },
                                             StringSplitOptions.RemoveEmptyEntries);
                foreach (var word in words)
                {
                    tree.Add(word);
                }

                Console.WriteLine($"words {tree.Count}");

                foreach (var word in tree)
                {
                    Console.WriteLine($"{word}");
                }

                Console.WriteLine();

                tree.Clear();
            }
        }
Example #2
0
        /// <summary>
        /// Checks if two threes are equal
        /// </summary>

        public bool Equal(BinaryTree tree)
        {
            return(IsEqual(Root, tree.Root));
        }