Exemplo n.º 1
0
        public void TestMethod2()
        {
            LLNode head    = LLNode.MakeList(1, 2, 3, 4);
            LLNode reverse = Reverse(head);

            CollectionAssert.AreEqual(new int[] { 4, 3, 2, 1 }, reverse.ToArray());
        }
Exemplo n.º 2
0
        public void TestMethod3()
        {
            LLNode head    = LLNode.MakeList(1, 2, 3, 4);
            string reverse = PrintReverseIterative(head);

            Assert.AreEqual("4 3 2 1", reverse.Trim());
        }
Exemplo n.º 3
0
        public void TestMethod1()
        {
            LLNode head   = LLNode.MakeList(5, 4, 3, 2, 1);
            LLNode sorted = Sort(head);

            CollectionAssert.AreEqual(new int[] { 1, 2, 3, 4, 5 }, sorted.ToArray());
        }
Exemplo n.º 4
0
        public void TestMethod2()
        {
            LLNode A = LLNode.MakeList(1, 3, 5, 7);
            LLNode B = LLNode.MakeList(2, 4, 6, 8);
            LLNode C = MergeRecurse(A, B);

            CollectionAssert.AreEqual(new int[] { 1, 2, 3, 4, 5, 6, 7, 8 }, C.ToArray());
        }