public CLinkedList LinkedList() { CLinkedList c = new CLinkedList(); c.Insert(4); c.Insert(3); c.Insert(4); c.Insert(2); c.Insert(1); c.Insert(4); c.print(); return(c); }
public void FindDuplicate() { CLinkedList c = new CLinkedList(); c.Insert(4); c.Insert(3); c.Insert(1); c.Insert(2); c.Insert(4); c.print(); var node = FindALoop(c); if (node != c.GetRoot()) { Console.WriteLine($"Faulty node is {node.Data}"); } else { Console.WriteLine($"No faulty node in c"); } CLinkedList c2 = new CLinkedList(); c2.Insert(5); c2.Insert(1); c2.Insert(3); c2.Insert(4); c2.print(); var node2 = FindALoop(c2); if (node2 != c2.GetRoot()) { Console.WriteLine($"Faulty node is {node2.Data}"); } else { Console.WriteLine($"No faulty node in c2"); } }