MCPcopy
hub / github.com/Jack-Lee-Hiter/AlgorithmsByPython / reverse

Method reverse

leetcode/143. Reorder List.py:37–45  ·  view source on GitHub ↗
(self, head)

Source from the content-addressed store, hash-verified

35 return head, middle
36 # reverse the behind half linkedlist
37 def reverse(self, head):
38 reHead = None
39 curNode = head
40 while curNode:
41 nextNode = curNode.next
42 curNode.next = reHead
43 reHead = curNode
44 curNode = nextNode
45 return reHead
46 # merge the two linkedlist to one
47 def reConnect(self, first, second):
48 head = first

Callers 4

reorderListMethod · 0.95
PrintMethod · 0.80
zigzagLevelOrderMethod · 0.80
zigzagLevelOrderMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected