MCPcopy Create free account
hub / github.com/BeeBombshell/Python-DSA / partition

Function partition

Sorting Algorithms/quick_sort.py:16–31  ·  view source on GitHub ↗
(array, low, high)

Source from the content-addressed store, hash-verified

14
15
16def partition(array, low, high):
17
18 pivot = array[high]
19
20 i = low - 1
21
22 for j in range(low, high):
23 if array[j] <= pivot:
24
25 i = i + 1
26
27 array[i], array[j] = array[j], array[i]
28
29 array[i + 1], array[high] = array[high], array[i + 1]
30
31 return i + 1
32
33
34def quickSort(array, low, high):

Callers 2

quickSortFunction · 0.85
quicksortMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected