File tree 1 file changed +5
-5
lines changed
data_structures/linked_list
1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ def __next__(self):
35
35
raise StopIteration
36
36
else :
37
37
value = self .current .data
38
- self .current = self .current .get_next ()
38
+ self .current = self .current .next
39
39
return value
40
40
41
41
@@ -49,15 +49,15 @@ def __str__(self):
49
49
nodes = []
50
50
while current is not None :
51
51
nodes .append (current .data )
52
- current = current .get_next ()
52
+ current = current .next
53
53
return " " .join (str (node ) for node in nodes )
54
54
55
55
def __contains__ (self , value : int ):
56
56
current = self .head
57
57
while current :
58
58
if current .data == value :
59
59
return True
60
- current = current .get_next ()
60
+ current = current .next
61
61
return False
62
62
63
63
def __iter__ (self ):
@@ -132,13 +132,13 @@ def get_node(self, item: int) -> Node:
132
132
while node :
133
133
if node .data == item :
134
134
return node
135
- node = node .get_next ()
135
+ node = node .next
136
136
raise Exception ("Node not found" )
137
137
138
138
def delete_value (self , value ):
139
139
if (node := self .get_node (value )) is not None :
140
140
if node == self .head :
141
- self .head = self .head .get_next ()
141
+ self .head = self .head .next
142
142
143
143
if node == self .tail :
144
144
self .tail = self .tail .previous
You can’t perform that action at this time.
0 commit comments