MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / partition

Function partition

Python/all sorting methods.py:125–133  ·  view source on GitHub ↗
(customList,low,high)

Source from the content-addressed store, hash-verified

123# QUICK SORT
124
125def partition(customList,low,high):
126 i = low - 1
127 pivot = customList[high]
128 for j in range(low,high):
129 if customList[j] <= pivot:
130 i+=1
131 customList[i],customList[j] = customList[j],customList[i]
132 customList[i+1],customList[high] = customList[high] , customList[i+1]
133 return (i+1)
134
135def quickSort(customList ,low ,high):
136 if low < high:

Callers 1

quickSortFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected