예제 #1
0
            static void Main(string[] args)
            {
                LinkedListMethods Linkedlist = new LinkedListMethods();

                Linkedlist.push(7);
                Linkedlist.push(1);
                Linkedlist.push(3);
                Linkedlist.push(2);

                Console.Write("Created Linked list is: ");
                Linkedlist.PrintList();

                Linkedlist.DeleteNode(1);
                Console.WriteLine();
                Console.Write("Created Linked list is: ");
                Linkedlist.PrintList();
            }
            static void Main(string[] args)
            {
                LinkedListMethods Linkedlist = new LinkedListMethods();

                Linkedlist.push(7);
                Linkedlist.push(1);
                Linkedlist.push(3);
                Linkedlist.push(2);
                Linkedlist.push(8);

                Console.Write("Linked list before deletion is: ");
                Linkedlist.PrintList();

                Linkedlist.DeleteNode(4);
                Console.WriteLine();
                Console.Write("Linked list after deletion is: ");
                Linkedlist.PrintList();
            }
        static void Main(string[] args)
        {
            LinkedListMethods Linkedlist = new LinkedListMethods();

            // Insert 6. so LinkedList becomes 6->null
            Linkedlist.Append(6);

            // Insert 7 at the beginning. so linked list becomes 7->6->null
            Linkedlist.push(7);

            // Insert 1 at the beginning. So list becomes 1->7->6->null
            Linkedlist.push(1);

            // Insert 4 at the end. so List becomes 1->7->6->4->null
            Linkedlist.Append(4);

            // Insert 8 after 7. So list becomes 1->7->8->6->4->null
            Linkedlist.InsertAfter(Linkedlist.head.next, 8);

            Console.Write("Created Linked list is: ");
            Linkedlist.PrintList();
        }