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

Method addFront

DSA/DoublyLinkedList.py:21–30  ·  view source on GitHub ↗
(self, x)

Source from the content-addressed store, hash-verified

19
20 #method to add an element in front the list i.e. head
21 def addFront(self, x):
22 new_node = Node(x)
23 if (self.isEmpty()):
24 self.head = self.tail = new_node
25 new_node.prev = None
26 return
27 new_node.next = self.head
28 self.head.prev = new_node
29 self.head = new_node
30 new_node.prev = None
31
32 #method to add an element in the last of the list i.e. tail
33 def addTail(self, x):

Callers 1

Calls 2

isEmptyMethod · 0.95
NodeClass · 0.70

Tested by

no test coverage detected