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

Method addToEmpty

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

Source from the content-addressed store, hash-verified

8 self.last = None
9
10 def addToEmpty(self, data):
11
12 if self.last != None:
13 return self.last
14
15 # allocate memory to the new node and add data to the node
16 newNode = Node(data)
17
18 # assign last to newNode
19 self.last = newNode
20
21 # create link to iteself
22 self.last.next = self.last
23 return self.last
24
25 def addFront(self, data):
26

Callers 3

addFrontMethod · 0.95
addEndMethod · 0.95

Calls 1

NodeClass · 0.70

Tested by

no test coverage detected