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

Method addFront

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

Source from the content-addressed store, hash-verified

23 return self.last
24
25 def addFront(self, data):
26
27 # check if the list is empty
28 if self.last == None:
29 return self.addToEmpty(data)
30
31 # allocate memory to the new node and add data to the node
32 newNode = Node(data)
33
34 # store the address of the current first node in the newNode
35 newNode.next = self.last.next
36
37 # make newNode as last
38 self.last.next = newNode
39
40 return self.last
41
42 def addEnd(self, data):
43 # check if the node is empty

Callers 1

Calls 2

addToEmptyMethod · 0.95
NodeClass · 0.70

Tested by

no test coverage detected