MCPcopy Create free account
hub / github.com/BeeBombshell/Python-DSA / addEnd

Method addEnd

DSA/circularLinkedList.py:42–59  ·  view source on GitHub ↗
(self, data)

Source from the content-addressed store, hash-verified

40 return self.last
41
42 def addEnd(self, data):
43 # check if the node is empty
44 if self.last == None:
45 return self.addToEmpty(data)
46
47 # allocate memory to the new node and add data to the node
48 newNode = Node(data)
49
50 # store the address of the last node to next of newNode
51 newNode.next = self.last.next
52
53 # point the current last node to the newNode
54 self.last.next = newNode
55
56 # make newNode as the last node
57 self.last = newNode
58
59 return self.last
60
61 def addAfter(self, data, item):
62

Callers 1

Calls 2

addToEmptyMethod · 0.95
NodeClass · 0.70

Tested by

no test coverage detected