コード例 #1
0
        public void AddToEndTest(int[] array, int value, int[] expectedArray)
        {
            DLinkedList actual   = new DLinkedList(array);
            DLinkedList expected = new DLinkedList(expectedArray);

            actual.AddToEnd(value);
            Assert.AreEqual(expected, actual);
        }
コード例 #2
0
        static void Main(string[] args)
        {
            DLinkedList <int> list = new DLinkedList <int>();

            list.AddToFront(5);
            list.AddToFront(3);
            list.AddToFront(1);
            list.AddToEnd(9);
            if (list.Search(5))
            {
                Console.WriteLine("This linked list includes 5");
            }
            else
            {
                Console.WriteLine("This linked list does not include 5");
            }
            if (list.Search(13))
            {
                Console.WriteLine("This linked list includes 13");
            }
            else
            {
                Console.WriteLine("This linked list does not include 13");
            }
            list.Display();

            DLinkedList <int> list2 = new DLinkedList <int>();

            list2.AddToOrderedList(400);
            list2.AddToOrderedList(40);
            list2.AddToOrderedList(4);
            list2.AddToOrderedList(450);
            list2.AddToOrderedList(50);
            //list2.Delete(50);
            list2.Delete(450);
            list2.Display();
            list2.DisplayReverse();
        }