Esempio n. 1
0
        public void SingleNodeList_ShouldNotDetectCycle()
        {
            ListNode head = new ListNode(3);

            LinkedListCycleDetectionSolution solution = new LinkedListCycleDetectionSolution();
            bool hasCycle = solution.Solve(head);

            hasCycle.Should().BeFalse();
        }
Esempio n. 2
0
        public void TwoNodeList_ShouldNotDetectCycle()
        {
            ListNode head   = new ListNode(3);
            ListNode second = new ListNode(4);

            head.next = second;

            LinkedListCycleDetectionSolution solution = new LinkedListCycleDetectionSolution();
            bool hasCycle = solution.Solve(head);

            hasCycle.Should().BeFalse();
        }