//Chapter 2 static void TestLinkedList() { Node head= new Node(1); LinkedList list = new LinkedList(head); list.AppendNewNode(new Node(2)); list.AppendNewNode(new Node(3)); list.AppendNewNode(new Node(4)); list.AppendNewNode(new Node(5)); list.AppendNewNode(new Node(2)); list.AppendNewNode(new Node(7)); list.AppendNewNode(new Node(8)); list.ToString(); list.RemoveDuplicateNode(); list.ToString(); list.AppendNewNode(new Node(2)); list.AppendNewNode(new Node(7)); list.ToString(); list.RemoveDuplicateNodeWithoutHashTable(); list.ToString(); //Find the Node which is Nth to the last node Node result = list.FindTheNthToLastNode(4); Console.WriteLine(result.Data); result = list.FindTheNthToLastNode(14); Console.WriteLine(result == null); result = list.FindTheNthToLastNode(0); Console.WriteLine(result.Data); result = list.FindTheNthToLastNode(1); Console.WriteLine(result.Data); Node s = null; LinkedList list2 = new LinkedList(s); result = list2.FindTheNthToLastNode(2); Console.WriteLine(result == null); }