Beispiel #1
0
        public void Test3()
        {
            var  linkedList = new LinkedList();
            Node repeatNode = new Node(null, 2);

            linkedList.AppendLinkedList(new Node(null, 1));
            var result = Class40.HasCycle(linkedList);

            Assert.False(result);
        }
Beispiel #2
0
        public void Test1()
        {
            var  linkedList = new LinkedList();
            Node repeatNode = new Node(null, 2);

            linkedList.AppendLinkedList(new Node(null, 1));
            linkedList.AppendLinkedList(repeatNode);
            linkedList.AppendLinkedList(new Node(null, 3));
            linkedList.AppendLinkedList(new Node(null, 4));
            linkedList.AppendLinkedList(new Node(repeatNode, 5));
            var result = Class40.HasCycle(linkedList);

            Assert.True(result);
        }