public void LinkedListSingleLinkFindIntersection1BruteForceCompleteTest3SameList() { // Note that since we need intersecting nodes, we can't use our helpers // to construct these lists. // Construct: // 11 -> 12 -> 13 // Initialize first list. var third1 = new LinkedListSingleLinkNode <int> { Value = 13 }; var second1 = new LinkedListSingleLinkNode <int> { Next = third1, Value = 12 }; var first1 = new LinkedListSingleLinkNode <int> { Next = second1, Value = 11 }; // Do check. Assert.AreEqual(first1, LinkedListSingleLinkFindIntersection1BruteForceComplete.FindIntersection(first1, first1)); }
public void LinkedListSingleLinkFindIntersection1BruteForceCompleteTest5NullList2() { var first1 = new LinkedListSingleLinkNode <int> { Value = 11 }; // Do check. Assert.AreEqual(null, LinkedListSingleLinkFindIntersection1BruteForceComplete.FindIntersection(first1, null)); }
public void LinkedListSingleLinkFindIntersection1BruteForceCompleteTest2NoIntersectionFound() { // Note that since we need intersecting nodes, we can't use our helpers // to construct these lists. // Construct: // 11 -> 12 -> 13 // 21 -> 22 -> 23 -> 24 // Initialize first list. var third1 = new LinkedListSingleLinkNode <int> { Value = 13 }; var second1 = new LinkedListSingleLinkNode <int> { Next = third1, Value = 12 }; var first1 = new LinkedListSingleLinkNode <int> { Next = second1, Value = 11 }; // Initialize second list. var fourth2 = new LinkedListSingleLinkNode <int> { Value = 24 }; var third2 = new LinkedListSingleLinkNode <int> { Next = fourth2, Value = 23 }; var second2 = new LinkedListSingleLinkNode <int> { Next = third2, Value = 22 }; var first2 = new LinkedListSingleLinkNode <int> { Next = second2, Value = 21 }; // Do check. Assert.AreEqual(null, LinkedListSingleLinkFindIntersection1BruteForceComplete.FindIntersection(first1, first2)); }
public void LinkedListSingleLinkFindIntersection1BruteForceCompleteTest6NullListBoth() { Assert.AreEqual(null, LinkedListSingleLinkFindIntersection1BruteForceComplete.FindIntersection(null, null)); }