public void TestMethod18() { SNode n4 = new SNode { data = 5 }; SNode n3 = new SNode { data = 4 }; SNode n2 = new SNode { data = 3 }; SNode n1 = new SNode { data = 2 }; SNode head = new SNode { data = 1 }; head.next = n1; n1.next = n2; n2.next = n3; n3.next = n4; Assert.AreEqual(-1, SinglyLinkedListOps.FindCycle(head)); }
public void TestMethod19() { SNode n1 = new SNode { data = 2 }; SNode head = new SNode { data = 1 }; head.next = n1; n1.next = head; Assert.AreEqual(2, SinglyLinkedListOps.FindCycle(head)); }