From c2c9a9e357e67e6615bc018f6cd5bc7b6d9095f1 Mon Sep 17 00:00:00 2001 From: mjk22071998 Date: Tue, 1 Oct 2024 16:20:23 +0500 Subject: [PATCH] "Renamed `numNodes` to `num_nodes` and decremented num_nodes in delete function --- data_structures/linked_list/sorted_linked_list.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/data_structures/linked_list/sorted_linked_list.py b/data_structures/linked_list/sorted_linked_list.py index c118696bc..a46172686 100644 --- a/data_structures/linked_list/sorted_linked_list.py +++ b/data_structures/linked_list/sorted_linked_list.py @@ -46,7 +46,7 @@ class SortedLinkedList: >>> linked_list.head is None True """ - self.numNodes: int = 0 + self.num_nodes: int = 0 self.head: Node | None = None self.tail: Node | None = None @@ -100,7 +100,7 @@ class SortedLinkedList: temp_node.next_node = new_node if new_node.next_node is None: self.tail = new_node - self.numNodes += 1 + self.num_nodes += 1 def display(self) -> None: """ @@ -165,7 +165,7 @@ class SortedLinkedList: self.tail = temp_node return True temp_node = temp_node.next_node - + self.num_nodes-=1 return False def search(self, data: int) -> bool: @@ -241,7 +241,7 @@ class SortedLinkedList: >>> linkedList.length() 2 """ - return self.numNodes + return self.num_nodes def min_value(self) -> int | None: """This function will return minimum value