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

Function partition

Sorting Algorithims/quicksort_linkedlist.py:41–56  ·  view source on GitHub ↗
(start, end)

Source from the content-addressed store, hash-verified

39
40
41def partition(start, end):
42 if start == None or start.next == None:
43 return start
44 prev, curr = start, start.next
45 pivot = prev.data
46 while curr != end:
47 if curr.data < pivot:
48 prev = prev.next
49 temp = prev.data
50 prev.data = curr.data
51 curr.data = temp
52 curr = curr.next
53 temp = prev.data
54 prev.data = start.data
55 start.data = temp
56 return prev
57
58
59# recursive quicksort for function calls

Callers 1

quicksort_LLFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected