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() { 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); }
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 list = new LinkedList(); Node head = list.buildList(10); Node cur = head; while (cur.next != null) cur = cur.next; cur.next = head.next.next.next; Console.WriteLine("Last node: {0}", cur.data); Console.WriteLine("Loop Start node: {0}", cur.next.data); FindStartOfLoop(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); }
public static void driver() { LinkedList list = new LinkedList(); Node head = list.buildList(10); Node cur = head; while (cur.next != null) { cur = cur.next; } cur.next = head.next.next.next; Console.WriteLine("Last node: {0}", cur.data); Console.WriteLine("Loop Start node: {0}", cur.next.data); FindStartOfLoop(head); }