Skip to content

Commit f859e6d

Browse files
Update doubly_linked_list_two.py
1 parent 2fcee6d commit f859e6d

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

data_structures/linked_list/doubly_linked_list_two.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
from dataclasses import dataclass
1313
from typing import Self, TypeVar
1414

15-
Data = TypeVar("Data")
15+
DataType = TypeVar("DataType")
1616

1717

1818
@dataclass
19-
class Node[Data]:
20-
data: Data
19+
class Node[DataType]:
20+
data: DataType
2121
previous: Self | None = None
2222
next: Self | None = None
2323

@@ -54,7 +54,7 @@ def __str__(self):
5454
current = current.next
5555
return " ".join(str(node) for node in nodes)
5656

57-
def __contains__(self, value: Data):
57+
def __contains__(self, value: DataType):
5858
current = self.head
5959
while current:
6060
if current.data == value:
@@ -89,7 +89,7 @@ def set_tail(self, node: Node) -> None:
8989
else:
9090
self.insert_after_node(self.tail, node)
9191

92-
def insert(self, value: Data) -> None:
92+
def insert(self, value: DataType) -> None:
9393
node = Node(value)
9494
if self.head is None:
9595
self.set_head(node)
@@ -118,7 +118,7 @@ def insert_after_node(self, node: Node, node_to_insert: Node) -> None:
118118

119119
node.next = node_to_insert
120120

121-
def insert_at_position(self, position: int, value: Data) -> None:
121+
def insert_at_position(self, position: int, value: DataType) -> None:
122122
current_position = 1
123123
new_node = Node(value)
124124
node = self.head

0 commit comments

Comments
 (0)