[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
This commit is contained in:
pre-commit-ci[bot] 2024-10-01 09:05:40 +00:00
parent eec1c3a98b
commit e89bb5c3a9

View File

@ -16,6 +16,7 @@ class Node:
>>> Node(None) >>> Node(None)
Node(None) Node(None)
""" """
def __init__(self, data) -> None: def __init__(self, data) -> None:
self.data: int = data self.data: int = data
self.next_node: Node | None = None self.next_node: Node | None = None
@ -72,7 +73,7 @@ class SortedLinkedList:
Args: Args:
data (int): the data of linked list data (int): the data of linked list
Doctests Doctests
>>> linked_list = SortedLinkedList() >>> linked_list = SortedLinkedList()
>>> linked_list.insert_tail(32) >>> linked_list.insert_tail(32)
@ -101,8 +102,8 @@ class SortedLinkedList:
def display(self) -> None: def display(self) -> None:
""" """
This function displays whole list This function displays whole list
Doctests Doctests
>>> linkedList=SortedLinedList() >>> linkedList=SortedLinedList()
>>> linkedList.insert(32) >>> linkedList.insert(32)
@ -129,9 +130,9 @@ class SortedLinkedList:
Returns: Returns:
bool: status whether the node got deleted or not bool: status whether the node got deleted or not
Doctests Doctests
>>> linkedList=SortedLinedList() >>> linkedList=SortedLinedList()
>>> linkedList.insert(32) >>> linkedList.insert(32)
>>> linkedList.insert(57) >>> linkedList.insert(57)
@ -172,7 +173,7 @@ class SortedLinkedList:
Returns: Returns:
bool: flag indicating whether data exists or not bool: flag indicating whether data exists or not
Doctests Doctests
>>> linkedList=SortedLinedList() >>> linkedList=SortedLinedList()
>>> linkedList.insert(32) >>> linkedList.insert(32)
@ -195,12 +196,12 @@ class SortedLinkedList:
Returns: Returns:
bool: flag indicating whether list is empty or not bool: flag indicating whether list is empty or not
Doctests Doctests
>>> linkedList=SortedLinedList() >>> linkedList=SortedLinedList()
>>> linkedList.is_empty() >>> linkedList.is_empty()
True True
>>> linkedList.insert(32) >>> linkedList.insert(32)
>>> linkedList.insert(57) >>> linkedList.insert(57)
>>> linkedList.insert(45) >>> linkedList.insert(45)
@ -208,7 +209,7 @@ class SortedLinkedList:
>>> linkedList.is_empty() >>> linkedList.is_empty()
False False
""" """
return self.head is None return self.head is None
def length(self) -> int: def length(self) -> int:
@ -217,9 +218,9 @@ class SortedLinkedList:
Returns: Returns:
int: The length of linked list int: The length of linked list
Doctests Doctests
>>> linkedList=SortedLinedList() >>> linkedList=SortedLinedList()
>>> linkedList.length() >>> linkedList.length()
0 0
@ -244,9 +245,9 @@ class SortedLinkedList:
Returns: Returns:
int | None: min value or None if list is empty int | None: min value or None if list is empty
Doctests Doctests
>>> linkedList=SortedLinedList() >>> linkedList=SortedLinedList()
>>> linkedList.insert(32) >>> linkedList.insert(32)
>>> linkedList.insert(57) >>> linkedList.insert(57)
@ -264,9 +265,9 @@ class SortedLinkedList:
Returns: Returns:
int | None: max value or None if list is empty int | None: max value or None if list is empty
Doctests Doctests
>>> linkedList=SortedLinedList() >>> linkedList=SortedLinedList()
>>> linkedList.insert(32) >>> linkedList.insert(32)
>>> linkedList.insert(57) >>> linkedList.insert(57)
@ -281,9 +282,9 @@ class SortedLinkedList:
def remove_duplicates(self) -> None: def remove_duplicates(self) -> None:
""" """
This Function will remove the duplicates from the list This Function will remove the duplicates from the list
Doctests Doctests
>>> linkedList=SortedLinedList() >>> linkedList=SortedLinedList()
>>> linkedList.insert(32) >>> linkedList.insert(32)
>>> linkedList.insert(57) >>> linkedList.insert(57)
@ -295,7 +296,7 @@ class SortedLinkedList:
>>> linkedList.display() >>> linkedList.display()
32 45 57 32 45 57
""" """
temp = self.head temp = self.head
while temp and temp.next_node: while temp and temp.next_node:
if temp.data == temp.next_node.data: if temp.data == temp.next_node.data:
@ -308,9 +309,9 @@ class SortedLinkedList:
Args: Args:
other_list (SortedLinkedList): The list to be merged other_list (SortedLinkedList): The list to be merged
Doctests Doctests
>>> linkedList=SortedLinedList() >>> linkedList=SortedLinedList()
>>> linkedList.insert(32) >>> linkedList.insert(32)
>>> linkedList.insert(57) >>> linkedList.insert(57)