Example #1
0
        static void Main(string[] args)
        {
            //TreeNode tn = new TreeNode(1);
            //TreeNode tn3 = new TreeNode(3);
            //tn3.children.Add(new TreeNode(5));
            //tn3.children.Add(new TreeNode(6));
            //tn.children.Add(tn3);
            //tn.children.Add(new TreeNode(2));
            //tn.children.Add(new TreeNode(4));
            //tn.Preorder1(tn);
            //tn.MaxArea(new int[] { 1, 8, 6, 2, 5, 4, 8, 3, 7 });
            BinaryTree tree = new BinaryTree();

            tree.preorder1();

            tree.isvalid();
            // new sum().sum3();
            // 定义一个无参数、int类型返回值的委托
            //Func<int> func = () =>
            //{
            //    Thread.Sleep(2000);
            //    return DateTime.Now.Day;
            //};
            //// 输出委托同步调用的返回值
            //Console.WriteLine($"func.Invoke()={func.Invoke()}");
            //// 委托的异步调用
            //IAsyncResult asyncResult = func.BeginInvoke(p =>
            // {
            //     Console.WriteLine(p.AsyncState);
            // }, "异步调用返回值");
            //// 输出委托异步调用的返回值
            //Console.WriteLine($"func.EndInvoke(asyncResult)={func.EndInvoke(asyncResult)}");
            //new randombox().Compute();
            //new Bsearch().getindex();
            //new LIS().Get();
            //sort.quick_sort();
            //sort.mergeSort();
            //sort.insertSort();
            //Stack<int> st = new Stack<int>();
            //st.Push(1);
            //st.Push(3);
            //var aaa = st.Pop();
            //HashSet<int> hs = new HashSet<int>();
            //hs.Add(1);
            //hs.Remove(1);
            ////   new LIS().lis(new int[] { 2, 1, 6, 3, 5, 4, 8, 7, 9 });
            var node = new IntNode(2);

            node.append(4);
            node.append(7);
            node.append(3);
            node.append(1);
            node.append(9);
            // var newnode = new IntNode(3);
            //  node.insert(newnode, 5);
            node.ReverseList();
            Console.WriteLine("Hello World!");
        }