We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6bb9a02 commit 81c46dfCopy full SHA for 81c46df
sorts/quick_sort.py
@@ -7,6 +7,7 @@
7
For manual testing run:
8
python3 quick_sort.py
9
"""
10
+from typing import List
11
12
13
def quick_sort(collection: list) -> list:
@@ -26,8 +27,8 @@ def quick_sort(collection: list) -> list:
26
27
if len(collection) < 2:
28
return collection
29
pivot = collection.pop() # Use the last element as the first pivot
- greater = [] # All elements greater than pivot
30
- lesser = [] # All elements less than or equal to pivot
+ greater: List[int] = [] # All elements greater than pivot
31
+ lesser: List[int] = [] # All elements less than or equal to pivot
32
for element in collection:
33
(greater if element > pivot else lesser).append(element)
34
return quick_sort(lesser) + [pivot] + quick_sort(greater)
0 commit comments