public void Right()
        {
            int[]    preTree = { 1, 2, 3 };
            int[]    midTree = { 3, 2, 1 };
            TreeNode tree    = Coding004.Tree(preTree.ToList(), midTree.ToList());

            int[]    preTree2 = { 1, 2, 3 };
            int[]    midTree2 = { 2, 1 };
            TreeNode child    = Coding004.Tree(preTree2.ToList(), midTree2.ToList());

            Assert.True(Coding017.HasSubTree(tree, child));
        }
        public void Test3()
        {
            int[]    preTree = { 1, 2, 4, 7, 3, 5, 6, 8 };
            int[]    midTree = { 4, 7, 2, 1, 5, 3, 8, 6 };
            TreeNode tree    = Coding004.Tree(preTree.ToList(), midTree.ToList());

            int[]    preTree2 = { 2, 4, 7 };
            int[]    midTree2 = { 4, 7, 2 };
            TreeNode child    = Coding004.Tree(preTree2.ToList(), midTree2.ToList());

            Assert.True(Coding017.HasSubTree(tree, child));
        }
        public void Left()
        {
            int[]    preTree = { 1, 2, 3, 4, 5 };
            int[]    midTree = { 1, 2, 3, 4, 5 };
            TreeNode tree    = Coding004.Tree(preTree.ToList(), midTree.ToList());

            int[]    preTree2 = { 1, 2, 3, 4, 5 };
            int[]    midTree2 = { 5, 4, 3, 2, 1 };
            TreeNode tree2    = Coding004.Tree(preTree2.ToList(), midTree2.ToList());

            Coding018.Mirror(tree);
            Assert.Equal(JsonConvert.SerializeObject(tree2), JsonConvert.SerializeObject(tree));
        }
        public void Test1()
        {
            int[]    preTree = { 8, 10, 11, 9, 6, 7, 5 }; //前序
            int[]    midTree = { 11, 10, 9, 8, 7, 6, 5 }; //中序
            TreeNode tree    = Coding004.Tree(preTree.ToList(), midTree.ToList());

            int[]    preTree2 = { 8, 6, 5, 7, 10, 9, 11 }; //前序
            int[]    midTree2 = { 5, 6, 7, 8, 9, 10, 11 }; //中序
            TreeNode tree2    = Coding004.Tree(preTree2.ToList(), midTree2.ToList());

            Coding018.Mirror(tree);
            Assert.Equal(JsonConvert.SerializeObject(tree2), JsonConvert.SerializeObject(tree));
        }
        public void One()
        {
            int[]      preTree = { 1 };
            int[]      midTree = { 1 };
            TreeNode   tree    = Coding004.Tree(preTree.ToList(), midTree.ToList());
            List <int> result  = new List <int>();

            Coding004.PreNode(tree, result);
            Assert.Equal(JsonConvert.SerializeObject(preTree), JsonConvert.SerializeObject(result));

            result.Clear();
            Coding004.MidNode(tree, result);
            Assert.Equal(JsonConvert.SerializeObject(midTree), JsonConvert.SerializeObject(result));
        }
        public void Common()
        {
            int[]      preTree = { 1, 2, 4, 7, 3, 5, 6, 8 };
            int[]      midTree = { 4, 7, 2, 1, 5, 3, 8, 6 };
            TreeNode   tree    = Coding004.Tree(preTree.ToList(), midTree.ToList());
            List <int> result  = new List <int>();

            Coding004.PreNode(tree, result);
            Assert.Equal(JsonConvert.SerializeObject(preTree), JsonConvert.SerializeObject(result));

            result.Clear();
            Coding004.MidNode(tree, result);
            Assert.Equal(JsonConvert.SerializeObject(midTree), JsonConvert.SerializeObject(result));
        }
        public void Test1()
        {
            int[]    preTree = { 1, 2, 4, 7, 3, 5, 6, 8 }; //前序
            int[]    midTree = { 4, 7, 2, 1, 5, 3, 8, 6 }; //中序
            TreeNode tree    = Coding004.Tree(preTree.ToList(), midTree.ToList());

            int[]    preTree2 = { 1, 2, 4, 7, 3, 5, 6, 8 };
            int[]    midTree2 = { 4, 7, 2, 1, 5, 3, 8, 6 };
            TreeNode child    = Coding004.Tree(preTree2.ToList(), midTree2.ToList());

            Assert.True(Coding017.HasSubTree(tree, child));

            int[]    preTree3 = { 1, 2, 4, 7, 3, 5, 9, 8 };
            int[]    midTree3 = { 4, 7, 2, 1, 5, 3, 8, 9 };
            TreeNode child3   = Coding004.Tree(preTree3.ToList(), midTree3.ToList());

            Assert.False(Coding017.HasSubTree(tree, child3));
        }