Exemplo n.º 1
0
 def test_detect_and_remove_loop(self):
     llist = LinkedList()
     llist.append(1)
     llist.append(2)
     llist.append(3)
     llist.append(4)
     llist.append(5)
     llist.head.next.next.next.next.next = llist.head.next.next
     self.assertTrue(llist.detect_loop())
     llist.detect_and_remove_loop()
     self.assertFalse(llist.detect_loop())
Exemplo n.º 2
0
 def test_detect_loop(self):
     llist = LinkedList()
     llist.append(1)
     llist.append(2)
     llist.append(3)
     llist.append(4)
     llist.append(5)
     llist.head.next.next.next.next.next = llist.head
     self.assertTrue(llist.detect_loop())