static void Main(string[] args)
        {
            TwoWayLinkedList DL = new TwoWayLinkedList();

            DL.AddFirst(5);
            DL.AddFirst(4);
            DL.AddFirst(3);
            DL.AddFirst(2);
            DL.AddFirst(1);
            Console.WriteLine(DL.Traverse());
            Console.WriteLine(DL.GetNode(4).Value);
            DL.AddPosition(4, 0);
            Console.WriteLine(DL.Traverse());
            DL.DeletePosition(5);
            Console.WriteLine(DL.Traverse());
            DL.DeleteLast();
            Console.WriteLine(DL.Traverse());
            DL.DeleteFirst();
            Console.WriteLine(DL.Traverse());
            DL.AddFirst(0);
            Console.WriteLine(DL.Traverse());
            DL.AddLast(999);
            Console.WriteLine(DL.Traverse());

            Console.ReadKey();
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            TwoWayLinkedList twoWayLinkedList = new TwoWayLinkedList();
            Node2            n1  = new Node2(1, "1");
            Node2            n2  = new Node2(2, "2");
            Node2            n3  = new Node2(3, "3");
            Node2            n4  = new Node2(4, "4");
            Node2            n5  = new Node2(5, "5");
            Node2            n14 = new Node2(1, "14");

            twoWayLinkedList.Add(n1);
            twoWayLinkedList.Add(n3);
            twoWayLinkedList.Add(n2);
            twoWayLinkedList.Add(n5);
            twoWayLinkedList.Add(n4);
            twoWayLinkedList.ToString();
            twoWayLinkedList.Update(n14);
            twoWayLinkedList.ToString();

            twoWayLinkedList.Delete(3);
            twoWayLinkedList.ToString();
            Console.Read();
        }