Example #1
0
        public void TestThirdCase()
        {
            var first  = new TreeNode(1, new TreeNode(2), new TreeNode(1));
            var second = new TreeNode(1, left: new TreeNode(1), right: new TreeNode(2));
            var sol    = new SameTree(first, second);
            var result = sol.IsSameTree();

            Assert.False(result);
        }
Example #2
0
        public void TestFirstCase()
        {
            var first  = new TreeNode(1, new TreeNode(2), new TreeNode(3));
            var second = new TreeNode(1, new TreeNode(2), new TreeNode(3));
            var sol    = new SameTree(first, second);
            var result = sol.IsSameTree();

            Assert.True(result);
        }
Example #3
0
        public bool IsSameTree(TreeNode p, TreeNode q)
        {
            var sameTree = new SameTree(p, q);

            return(sameTree.IsSameTree());
        }