예제 #1
0
        public void ContainsLoopHash_7154c52874_true()
        {
            SingleLinkedList <int> list = SingleLinkedList <int> .GenerateCyclic(
                new int[] { 7, 1, 5, 4 },
                new int[] { 5, 2, 8, 7, 4 }
                );

            var cyclic = list.ContainsLoopHashSet();

            Assert.IsTrue(cyclic);
        }
예제 #2
0
        public void ContainsLoopHash_7154_false()
        {
            SingleLinkedList <int> list = new SingleLinkedList <int>();

            list.InsertAtEnd(7);
            list.InsertAtEnd(1);
            list.InsertAtEnd(5);
            list.InsertAtEnd(4);

            var cyclic = list.ContainsLoopHashSet();

            Assert.IsFalse(cyclic);
        }