MCPcopy Create free account
hub / github.com/geekcomputers/Python / Delete

Method Delete

Delete_Linked_List.py:21–35  ·  view source on GitHub ↗
(self, key)

Source from the content-addressed store, hash-verified

19 current.next = new_node
20
21 def Delete(self, key):
22 temp = self.head
23 if temp is None:
24 return "Can't Delete!"
25 else:
26 if temp.data == key:
27 self.head = temp.next
28 temp = None
29 while temp is not None:
30 prev = temp
31 temp = temp.next
32 curr = temp.next
33 if temp.data == key:
34 prev.next = curr
35 return
36
37 def Display(self):
38 temp = self.head

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected