Ejemplo n.º 1
0
        public void SumTwoLinkedListsAgain()
        {
            var sum      = new SumLists();
            var a        = new Node <int>(3, new Node <int>(8, new Node <int>(3, new Node <int>(9, new Node <int>(7, new Node <int>(9, null))))));
            var b        = new Node <int>(4, null);
            var expected = new Node <int>(7, new Node <int>(8, new Node <int>(3, new Node <int>(9, new Node <int>(7, new Node <int>(9, null))))));
            var actual   = sum.SumLinkedLists(a, b);

            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 2
0
        public void SumTwoLinkedLists()
        {
            var sum      = new SumLists();
            var x        = new Node <int>(6, new Node <int>(5, new Node <int>(8, new Node <int>(2, null)))); //  2856
            var y        = new Node <int>(7, new Node <int>(4, new Node <int>(9, new Node <int>(3, null)))); // +3947 = 6803
            var expected = new Node <int>(3, new Node <int>(0, new Node <int>(8, new Node <int>(6, null))));
            var actual   = sum.SumLinkedLists(x, y);

            Assert.AreEqual(expected, actual);
        }