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

Method addFront

DSA/SinglyLinkedList.py:32–38  ·  view source on GitHub ↗
(self, x)

Source from the content-addressed store, hash-verified

30
31 #method to add an element in the front i.e. head
32 def addFront(self, x):
33 new_node = Node(x)
34 if (self.isEmpty()):
35 self.head = self.tail = new_node
36 return
37 new_node.next = self.head
38 self.head = new_node
39
40 #method to add element in the last i.e. tail
41 def addTail(self, x):

Callers 2

insertMethod · 0.95

Calls 2

isEmptyMethod · 0.95
NodeClass · 0.70

Tested by

no test coverage detected