MCPcopy Index your code
hub / github.com/hustcc/JS-Sorting-Algorithm / partition

Function partition

src/pythonSortTest.py:111–121  ·  view source on GitHub ↗
(arr, left, right)

Source from the content-addressed store, hash-verified

109
110
111def partition(arr, left, right):
112 pivot = left
113 index = pivot + 1
114 i = index
115 while i <= right:
116 if arr[i] < arr[pivot]:
117 swap(arr, i, index)
118 index += 1
119 i += 1
120 swap(arr, pivot, index - 1)
121 return index - 1
122
123
124def swap(arr, i, j):

Callers 1

quickSortFunction · 0.70

Calls 1

swapFunction · 0.70

Tested by

no test coverage detected