Esempio n. 1
0
        public static DuplicableSimpleBSTree <string, string> GenerateFromText(string text)
        {
            var tree = new DuplicableSimpleBSTree <string, string>();

            foreach (var symbol in text.Split(' ', '\t', '\n'))
            {
                tree.Add(symbol, symbol);
            }

            return(tree);
        }
Esempio n. 2
0
        public static DuplicableSimpleBSTree <char, char> GenerateFromString(string text)
        {
            var tree = new DuplicableSimpleBSTree <char, char>();

            foreach (var symbol in text)
            {
                tree.Add(symbol, symbol);
            }

            return(tree);
        }
Esempio n. 3
0
        public static DuplicableSimpleBSTree <int, char> GenerateLabExpressionTree()
        {
            var tree = new DuplicableSimpleBSTree <int, char>(1, '+');

            tree.Add(0, '9');
            tree.Add(3, '*');
            tree.Add(2, '8');
            tree.Add(5, '+');
            tree.Add(4, '7');
            tree.Add(15, '+');
            tree.Add(16, '1');
            tree.Add(11, '-');
            tree.Add(13, '-');
            tree.Add(12, '3');
            tree.Add(14, '2');
            tree.Add(7, '*');
            tree.Add(6, '6');
            tree.Add(9, '+');
            tree.Add(8, '5');
            tree.Add(10, '4');

            return(tree);
        }