public void Add(Node node) { if (head == null) { head = node; current = node; } else { current.Next = node; current = node; } }
private LinkedList _ConstructLinkedListWithLoop() { Node n1 = new Node(10); Node n2 = new Node(20); Node n3 = new Node(30); Node n4 = new Node(40); Node n5 = new Node(50); Node n6 = new Node(60); n1.Next = n2; n2.Next = n3; n3.Next = n4; n4.Next = n5; n5.Next = n6; n6.Next = n3; LinkedList lnkdLst = new LinkedList(); lnkdLst.head = n1; return lnkdLst; }