Example #1
0
        private static void TimeSpendTest()
        {
            RBTree   tree  = new RBTree();
            DateTime start = DateTime.Now;

            FileHelper.ReadFile(@"E:\数据\测试数据\numbers.txt", (num) => tree.Add(num));
            Console1.WriteLine("创建树耗时:" + (DateTime.Now - start).TotalMilliseconds);

            start = DateTime.Now;
            FileHelper.ReadFile(@"E:\数据\测试数据\numbers.txt", (num) => tree.FindNode(num));
            Console1.WriteLine("查找树耗时:" + (DateTime.Now - start).TotalMilliseconds);

            start = DateTime.Now;
            FileHelper.ReadFile(@"E:\数据\测试数据\numbers.txt", (num) => tree.Remove(num));
            Console1.WriteLine("清空树耗时:" + (DateTime.Now - start).TotalMilliseconds);
        }