MCPcopy Create free account
hub / github.com/AdarshAddee/Hacktoberfest2022_for_Beginers / partition

Function partition

Python/QuickSort.py:3–17  ·  view source on GitHub ↗
(A, low, high)

Source from the content-addressed store, hash-verified

1# anupkafle
2
3def partition(A, low, high):
4 pivot = A[low]
5 i = low + 1
6 j = high
7 while True:
8 while i <= j and A[i] <= pivot:
9 i = i + 1
10 while i <=j and A[j] > pivot:
11 j = j - 1
12 if i <= j:
13 A[i], A[j] = A[j], A[i]
14 else:
15 break
16 A[low], A[j] = A[j], A[low]
17 return j
18
19
20def quicksort(A, low, high):

Callers 1

quicksortFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected