Exemplo n.º 1
0
        static void Main(string[] args)
        {
            DoublyLinkedList mylist = new DoublyLinkedList();

            mylist.Append("Preet");
            mylist.Append("David");
            mylist.Append("Paul");
            mylist.Prepend("Shaw");
            mylist.PrintList();
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            //Create Linked list
            var dll = new DoublyLinkedList <int>(7);

            dll.Print();

            //Push 1 at the beginning of the list
            dll.Push(1);

            //Push 2 at the beginning of the list
            dll.Push(2);

            //Push 4 after Head.Next
            var four = dll.InsertAfter(dll.Head.Next, 4);

            //Push 5 before 1
            dll.InsertBefore(dll.Head.Next, 5);

            //Append 9
            var nine = dll.Append(9);

            //Deletes 2 and makes 1 Head
            dll.Delete(dll.Head);

            //Delete 9
            dll.Delete(nine);

            //Delete 4
            dll.Delete(four);

            Console.ReadLine();

            dll.Print();
            //Finish program
            Console.ReadLine();
        }