Example #1
0
        public static void driver()
        {
            int[]      arr  = { 1, 5, 2, 7, 3, 1, 8, 2, 8 };
            LinkedList list = new LinkedList();
            Node       head = list.buildList(arr);

            RemoveDuplicates(head);
            LinkedList.printList(head);
        }
Example #2
0
        public static void driver()
        {
            LinkedList list = new LinkedList();
            Node       head = list.buildList(10);

            LinkedList.printList(head);
            Console.WriteLine();
            GetNthFromEnd(head, 11);
        }
        public static void driver()
        {
            LinkedList list = new LinkedList();
            Node       head = list.buildList(10);

            Console.WriteLine("Before deleting: ");
            LinkedList.printList(head);
            deleteNode(head.next.next.next.next);
            Console.WriteLine("\nAfter deleting: ");
            LinkedList.printList(head);
        }
        public static void driver()
        {
            LinkedList listA   = new LinkedList();
            Node       a       = listA.buildList(10);
            LinkedList listB   = new LinkedList();
            Node       b       = listB.buildList(11);
            Node       sumList = AddLists(a, b);

            Console.WriteLine("List a: ");
            LinkedList.printList(a);
            Console.WriteLine("\nList a: ");
            LinkedList.printList(b);
            Console.WriteLine("\nSum: ");
            LinkedList.printList(sumList);
        }