We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cba19dd commit fcbd0f2Copy full SHA for fcbd0f2
Python/chapter02/2.4 - Partition/camilo_solution_2.4.py
@@ -87,6 +87,7 @@ def partition(self,num):
87
list_B = linklist()
88
curr = self.head
89
# Idea: Make two seperate llink and smash them together
90
+
91
while curr is not None:
92
if curr.data <= num:
93
list_A.push(curr.data)
@@ -97,14 +98,12 @@ def partition(self,num):
97
98
list_B.printList()
99
100
#Go through all of A the point the end of A to the begining of B
101
102
self.head = list_A.head
103
head_A = list_A.head
- while head_A:
- if head_A.next is not None:
104
- head_A = head_A.next
105
-
106
- head_A.next = list_B.head
+ while head_A.next:
107
head_A = head_A.next
+ head_A.next = list_B.head
108
109
110
0 commit comments