コード例 #1
0
        public void Test_DeleteMiddle(int[] values, bool expected)
        {
            var head    = new CTCI_LLNode <int>(values[0]);
            var current = head;

            for (int i = 1; i < values.Length; i++)
            {
                current.Next = new CTCI_LLNode <int>(values[i]);
                current      = current.Next;
            }
            var actual = sut.DeleteMiddle(head);

            Assert.Equal(expected, actual);
        }
コード例 #2
0
        public void TestRemoveDuplicates(int[] values)
        {
            var head    = new CTCI_LLNode <int>(values[0]);
            var current = head;

            for (int i = 1; i < values.Length; i++)
            {
                current.Next          = new CTCI_LLNode <int>(values[i]);
                current.Next.Previous = current;
                current = current.Next;
            }
            sut.RemoveDuplicates(head);
            Assert.Equal(1, 1);
        }