MCPcopy Index your code
hub / github.com/BeeBombshell/Python-DSA / delete

Method delete

DSA/SinglyLinkedList.py:88–106  ·  view source on GitHub ↗
(self, v)

Source from the content-addressed store, hash-verified

86
87 #method to delete a specific element
88 def delete(self, v):
89 if self.isEmpty():
90 return
91 temp = self.head
92 if temp.data == v:
93 self.head = temp.next
94 temp = None
95 return
96 else:
97 while temp.next != None:
98 if temp.data == v:
99 break
100 temp = temp.next
101 if temp.next == None:
102 return
103 temp.data = None
104 if temp.next != None:
105 temp.data = temp.next.data
106 temp.next = temp.next.next
107
108 #meethod to display the nodes of the list
109 def display(self):

Callers 1

Calls 1

isEmptyMethod · 0.95

Tested by

no test coverage detected