From 94a9bd3626fd1e9a9f8d3079e9feb40c2922bf0c Mon Sep 17 00:00:00 2001 From: julien lengrand-lambert Date: Sun, 8 Dec 2013 14:41:04 +0100 Subject: [PATCH] The special case node = 0 is needed --- 04_linkedList/ll.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/04_linkedList/ll.py b/04_linkedList/ll.py index caa3f90..6f17b03 100644 --- a/04_linkedList/ll.py +++ b/04_linkedList/ll.py @@ -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