public void ConnectTests()
        {
            PopulatingNextRightPointersinEachNodeII obj = new PopulatingNextRightPointersinEachNodeII();


            var node = new Node(1)
            {
                left = new Node(2)
                {
                    left = new Node(4)
                    {
                    },
                    right = new Node(5)
                    {
                    }
                },
                right = new Node(3)
                {
                    right = new Node(7)
                    {
                    }
                }
            };

            var x = obj.Connect(node);

            node = new Node(1)
            {
                left = new Node(2)
                {
                }
            };

            x = obj.Connect(node);
        }
コード例 #2
0
        public void TestMethod1()
        {
            // Arrange
            PopulatingNextRightPointersinEachNodeII question = new PopulatingNextRightPointersinEachNodeII();
            TreeLinkNode root = new TreeLinkNode(1);

            root.left           = new TreeLinkNode(2);
            root.left.left      = new TreeLinkNode(3);
            root.left.left.left = new TreeLinkNode(4);
            root.right          = new TreeLinkNode(5);

            // Act
            question.Connect(root);
        }