The special case node = 0 is needed

This commit is contained in:
julien lengrand-lambert
2013-12-08 14:41:04 +01:00
parent 6b750028f9
commit 94a9bd3626

View File

@@ -59,11 +59,11 @@ class SingleLinkedList():
elif node >= self._size:
raise Exception("Requested value out of list bounds")
else:
# I want to traverse the list only once
# Find the element before
# Find the element after
# Link the element after to the element before
# Reduce the size
# I want to traverse the list only once
item = self._root
for i in range(node - 1):
item = item.nexti