MCPcopy Create free account
hub / github.com/geekcomputers/Python / insert_at_beginning

Method insert_at_beginning

Add_two_Linked_List.py:11–17  ·  view source on GitHub ↗
(self, new_data)

Source from the content-addressed store, hash-verified

9 self.head = None
10
11 def insert_at_beginning(self, new_data):
12 new_node = Node(new_data)
13 if self.head is None:
14 self.head = new_node
15 return
16 new_node.next = self.head
17 self.head = new_node
18
19 def add_two_no(self, first, second):
20 prev = None

Callers 1

Calls 1

NodeClass · 0.70

Tested by

no test coverage detected