We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3787300 commit 2bb11e6Copy full SHA for 2bb11e6
Merge Sort/quick_sort.py
@@ -0,0 +1,14 @@
1
+def QuickSort(arr, left, right):
2
+ x = arr[(left + right) // 2]
3
+ i = left
4
+ j = right - 1
5
+ while i <= j:
6
+ while arr[i] < x: i+= 1
7
+ while arr[j] > x: j-= 1
8
+ if i <= j:
9
+ arr[i], arr[j] = arr[j], arr[i]
10
+ i+= 1
11
+ j-= 1
12
+ if left < j: arr = QuickSort(arr, left, j + 1);
13
+ if i < right: arr = QuickSort(arr, i, right);
14
+ return arr
0 commit comments