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

Class LinkedList

Sorting Algorithims/mergesort_linkedlist.py:10–27  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8
9
10class LinkedList:
11 def __init__(self):
12 self.head = None
13
14 def insert(self, new_data: int) -> None:
15 new_node = Node(new_data)
16 new_node.next = self.head
17 self.head = new_node
18
19 def printLL(self) -> None:
20 temp = self.head
21 if temp == None:
22 return "Linked List is empty"
23 while temp.next:
24 print(temp.data, "->", end="")
25 temp = temp.next
26 print(temp.data)
27 return
28
29
30# Merge two sorted linked lists

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected