Skip to content

Commit 5218d67

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent dc7c493 commit 5218d67

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

sorts/quick_sort.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def quick_sort(collection: list) -> list:
2727
Space Complexity:
2828
Best Case: O(log n) for In-place implementation
2929
Worst Case: O(n)
30-
30+
3131
Examples:
3232
>>> quick_sort([0, 5, 3, 2, 2])
3333
[0, 2, 2, 3, 5]
@@ -45,17 +45,17 @@ def quick_sort(collection: list) -> list:
4545
pivot = collection.pop(pivot_index)
4646

4747
# Initialise empty lists to store the elements
48-
48+
4949
lesser = [] # Stores elements less than or equal to the pivot
50-
greater = [] # Stores elements greater than the pivot
50+
greater = [] # Stores elements greater than the pivot
5151

5252
# Loop through the collections and partition
5353
for item in collection:
5454
if item <= pivot:
5555
lesser.append(item)
5656
else:
5757
greater.append(item)
58-
58+
5959
# Recursively sort the lesser and greater groups, and combine with the pivot
6060
return [*quick_sort(lesser), pivot, *quick_sort(greater)]
6161

0 commit comments

Comments
 (0)