| 14 | |
| 15 | |
| 16 | class LinkedList: |
| 17 | def __init__(self): |
| 18 | self.head = None |
| 19 | |
| 20 | # method to insert nodes at the start of linkedlist |
| 21 | def insert(self, new_data: int) -> None: |
| 22 | new_node = Node(new_data) |
| 23 | new_node.next = self.head |
| 24 | self.head = new_node |
| 25 | |
| 26 | # method to print the linkedlist |
| 27 | def printLL(self) -> None: |
| 28 | temp = self.head |
| 29 | if temp == None: |
| 30 | return "Linked List is empty" |
| 31 | while temp.next: |
| 32 | print(temp.data, "->", end="") |
| 33 | temp = temp.next |
| 34 | print(temp.data) |
| 35 | return |
| 36 | |
| 37 | |
| 38 | # Partition algorithm with pivot as first element |
no outgoing calls
no test coverage detected