Skip to content

Commit 43809be

Browse files
Update doubly_linked_list_two.py
1 parent 5761089 commit 43809be

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Diff for: data_structures/linked_list/doubly_linked_list_two.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def __next__(self):
3434
if not self.current:
3535
raise StopIteration
3636
else:
37-
value = self.current.get_data()
37+
value = self.current.data
3838
self.current = self.current.get_next()
3939
return value
4040

@@ -48,14 +48,14 @@ def __str__(self):
4848
current = self.head
4949
nodes = []
5050
while current is not None:
51-
nodes.append(current.get_data())
51+
nodes.append(current.data)
5252
current = current.get_next()
5353
return " ".join(str(node) for node in nodes)
5454

5555
def __contains__(self, value: int):
5656
current = self.head
5757
while current:
58-
if current.get_data() == value:
58+
if current.data == value:
5959
return True
6060
current = current.get_next()
6161
return False
@@ -65,12 +65,12 @@ def __iter__(self):
6565

6666
def get_head_data(self):
6767
if self.head:
68-
return self.head.get_data()
68+
return self.head.data
6969
return None
7070

7171
def get_tail_data(self):
7272
if self.tail:
73-
return self.tail.get_data()
73+
return self.tail.data
7474
return None
7575

7676
def set_head(self, node: Node) -> None:
@@ -130,7 +130,7 @@ def insert_at_position(self, position: int, value: int) -> None:
130130
def get_node(self, item: int) -> Node:
131131
node = self.head
132132
while node:
133-
if node.get_data() == item:
133+
if node.data == item:
134134
return node
135135
node = node.get_next()
136136
raise Exception("Node not found")

0 commit comments

Comments
 (0)