python-data-structures
python-data-structures copied to clipboard
Missing last = n in LinkedList remove method
def remove(self, value):
n = self.head
last = None
while n != None:
if n.value == value:
if last == None:
self.head = self.head.next
else:
last.next = n.next
return True
last = n **<-- This is missing**
n = n.next
return False