示例#1
0
        static void Main(string[] args)
        {
            MyLinkedList list = new MyLinkedList();

            list.AddAtHead(1);
            list.AddAtTail(3);
            list.AddAtIndex(1, 5);
            list.DeleteAtIndex(2);
            Console.WriteLine("Size is " + list.Size());
            list.AddAtHead(14);
            Console.WriteLine("Size is " + list.Size());
            list.PrintAllValues();
            Console.WriteLine(list.Get(1));
            Console.WriteLine("Tail: " + list.getTail().getValue());
            Console.WriteLine("Head: " + list.getHead().getValue());
        }
示例#2
0
        static void Main(string[] args)
        {
            var list = new MyLinkedList();

            list.AddAtHead(7);
            list.AddAtHead(2);
            list.AddAtHead(1);

            list.AddAtIndex(3, 0);
            list.DeleteAtIndex(2);


            list.AddAtHead(6);
            list.AddAtTail(4);

            Console.WriteLine(list.Get(4));
        }
示例#3
0
        static void Main(string[] args)
        {
            MyLinkedList obj = new MyLinkedList();

            obj.AddAtHead(7);
            obj.AddAtTail(3);
            obj.AddAtHead(9);
            obj.AddAtTail(8);
            obj.AddAtHead(6);
            obj.AddAtHead(0);
            var supposedToBe8 = obj.Get(5);

            obj.AddAtHead(0);
            obj.Get(2);
            obj.Get(5);
            obj.AddAtTail(4);
        }