예제 #1
0
 def test1(self):
     self.assertTrue(
         linked_lists.equals(
             EXPECTED1, SOLUTION1.reverseBetween(HEAD1(), LEFT1, RIGHT1)))
     self.assertTrue(
         linked_lists.equals(
             EXPECTED2, SOLUTION1.reverseBetween(HEAD2(), LEFT2, RIGHT2)))
예제 #2
0
 def test1(self):
     self.assertTrue(
         linked_lists.equals(EXPECTED1, SOLUTION1.sortList(HEAD1())))
     self.assertTrue(
         linked_lists.equals(EXPECTED2, SOLUTION1.sortList(HEAD2())))
     self.assertTrue(
         linked_lists.equals(EXPECTED3, SOLUTION1.sortList(HEAD3())))
 def test2(self):
     self.assertTrue(
         linked_lists.equals(EXPECTED1, SOLUTION2.mergeKLists(LISTS1())))
     self.assertTrue(
         linked_lists.equals(EXPECTED2, SOLUTION2.mergeKLists(LISTS2)))
     self.assertTrue(
         linked_lists.equals(EXPECTED3, SOLUTION2.mergeKLists(LISTS3)))
예제 #4
0
 def test1(self):
     self.assertTrue(
         linked_lists.equals(EXPECTED1, SOLUTION1.addTwoNumbers(L11, L12)))
     self.assertTrue(
         linked_lists.equals(EXPECTED2, SOLUTION1.addTwoNumbers(L21, L22)))
     self.assertTrue(
         linked_lists.equals(EXPECTED3, SOLUTION1.addTwoNumbers(L31, L32)))
예제 #5
0
 def test1(self):
     self.assertTrue(
         linked_lists.equals(EXPECTED1,
                             SOLUTION1.deleteDuplicates(HEAD1())))
     self.assertTrue(
         linked_lists.equals(EXPECTED2,
                             SOLUTION1.deleteDuplicates(HEAD2())))
 def test1(self):
     head1 = HEAD1()
     self.assertTrue(
         linked_lists.equals(EXPECTED1, SOLUTION1.insertionSortList(head1)))
     head2 = HEAD2()
     self.assertTrue(
         linked_lists.equals(EXPECTED2, SOLUTION1.insertionSortList(head2)))
예제 #7
0
    def test1(self):
        head1 = HEAD1()
        SOLUTION1.reorderList(head1)
        self.assertTrue(linked_lists.equals(EXPECTED1, head1))

        head2 = HEAD2()
        SOLUTION1.reorderList(head2)
        self.assertTrue(linked_lists.equals(EXPECTED2, head2))
예제 #8
0
    def test1(self):
        head1 = linked_lists.from_values(*VALUES1)
        head1 = SOLUTION1.rotateRight(head1, K1)
        self.assertTrue(linked_lists.equals(EXPECTED1, head1))

        head2 = linked_lists.from_values(*VALUES2)
        head2 = SOLUTION1.rotateRight(head2, K2)
        self.assertTrue(linked_lists.equals(EXPECTED2, head2))
 def test1(self):
     self.assertTrue(
         linked_lists.equals(EXPECTED1,
                             SOLUTION1.mergeTwoLists(L11(), L12())))
     self.assertTrue(
         linked_lists.equals(EXPECTED2, SOLUTION1.mergeTwoLists(L21, L22)))
     self.assertTrue(
         linked_lists.equals(EXPECTED3, SOLUTION1.mergeTwoLists(L31,
                                                                L32())))
예제 #10
0
 def test1(self):
     self.assertTrue(
         linked_lists.equals(EXPECTED1, SOLUTION1.partition(HEAD1, X1)))
     self.assertTrue(
         linked_lists.equals(EXPECTED2, SOLUTION1.partition(HEAD2, X2)))
예제 #11
0
 def test1(self):
     self.assertTrue(linked_lists.equals(EXPECTED1, SOLUTION1.reverseKGroup(HEAD1(), K1)))
     self.assertTrue(linked_lists.equals(EXPECTED2, SOLUTION1.reverseKGroup(HEAD2(), K2)))
     self.assertTrue(linked_lists.equals(EXPECTED3, SOLUTION1.reverseKGroup(HEAD3(), K3)))
     self.assertTrue(linked_lists.equals(EXPECTED4, SOLUTION1.reverseKGroup(HEAD4(), K4)))
 def test1(self):
     self.assertTrue(linked_lists.equals(EXPECTED1, SOLUTION1.removeNthFromEnd(HEAD1(), N1)))
     self.assertTrue(linked_lists.equals(EXPECTED2, SOLUTION1.removeNthFromEnd(HEAD2(), N2)))
     self.assertTrue(linked_lists.equals(EXPECTED3, SOLUTION1.removeNthFromEnd(HEAD3(), N3)))