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

Method Rotation

Rotate_Linked_List.py:19–34  ·  view source on GitHub ↗
(self, key)

Source from the content-addressed store, hash-verified

17 self.head = new_node
18
19 def Rotation(self, key):
20 if key == 0:
21 return
22 current = self.head
23 count = 1
24 while count < key and current is not None:
25 current = current.next
26 count += 1
27 if current is None:
28 return
29 Kth_Node = current
30 while current.next is not None:
31 current = current.next
32 current.next = self.head
33 self.head = Kth_Node.next
34 Kth_Node.next = None
35
36 def Display(self):
37 temp = self.head

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected