Esempio n. 1
0
        static void Main(string[] args)
        {
            Node root = null;
            Tree BST  = new Tree();

            for (int i = 0; i < BST.ns.Length; i++)
            {
                DateTime dat1 = DateTime.Now;
                BST.InsertIncreasing(BST.FillIncreasing(BST.ns[i]), ref root, BST.ns.Length);
                DateTime dat2 = DateTime.Now;
                var      span = dat2 - dat1;
                Debug.Assert(BST.IsBST(root));
                Console.WriteLine(span);
                int[] shuffle = BST.FillIncreasing(BST.ns[i]);
                BST.Shuffle(ref shuffle, BST.ns[i]);
                DateTime dat3 = DateTime.Now;
                for (int j = 0; j < shuffle.Length; j++)
                {
                    BST.Search(root, shuffle[j]);
                }
                DateTime dat4  = DateTime.Now;
                var      span2 = dat4 - dat3;
                Console.WriteLine(span2);
            }
        }