static void Main(string[] args) { int[] data = { 44, 55, 44, 55, 55, 66, 66 }; Node head = null; foreach (int i in data) { head = LinkedListHelpers.AddToBeginning(i); } LinkedListHelpers.removeDuplicates(head); LinkedListHelpers.Print(); }
public static void Main(string[] args) { var newLinkedList = new SinglyLinkedList(); newLinkedList.Add("B"); newLinkedList.Add("A"); newLinkedList.Add("B"); newLinkedList.Add("E"); newLinkedList.Add("E"); newLinkedList.Add("B"); newLinkedList.Add("E"); Console.WriteLine("Before calling method -> " + newLinkedList.Count); LinkedListHelpers.RemoveNodesWithMoreThanTwoInstances(newLinkedList.Head); Console.WriteLine("====="); newLinkedList.PrintList(); Console.WriteLine("\n====="); Console.WriteLine("After calling method -> " + newLinkedList.Count); }