Esempio n. 1
0
        static void Main(string[] args)
        {
            AVLTree <int> tryTree = new AVLTree <int>();

            tryTree.Add(5);
            tryTree.Add(3);
            tryTree.Add(7);
            tryTree.Add(2);
            tryTree.Add(12);
            tryTree.Add(15);
            tryTree.Add(21);

            foreach (var item in tryTree)
            {
                Console.WriteLine(item);
            }

            Console.WriteLine(tryTree.Contains(5));

            tryTree.Remove(3);

            foreach (var item in tryTree)
            {
                Console.WriteLine(item);
            }

            tryTree.Clear();

            foreach (var item in tryTree)
            {
                Console.WriteLine(item);
            }
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            AVLTree <int> balancetree = new AVLTree <int>();

            balancetree.Add(5);
            balancetree.Add(3);
            balancetree.Add(7);
            balancetree.Add(2);
            balancetree.Add(12);
            balancetree.Add(15);
            balancetree.Add(21);

            foreach (var number in balancetree)
            {
                Console.WriteLine(number);
            }

            Console.WriteLine(balancetree.Contains(5));

            balancetree.Remove(3);

            foreach (var number in balancetree)
            {
                Console.WriteLine(number);
            }

            balancetree.Clear();

            foreach (var number in balancetree)
            {
                Console.WriteLine(number);
            }
        }