Skip to content

Commit 48553da

Browse files
Azarealicepoyea
authored andcommitted
variable in function should be lowercase (TheAlgorithms#768)
1 parent 2fc2ae3 commit 48553da

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

sorts/quick_sort.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from __future__ import print_function
1313

1414

15-
def quick_sort(ARRAY):
15+
def quick_sort(collection):
1616
"""Pure implementation of quick sort algorithm in Python
1717
1818
:param collection: some mutable ordered collection with heterogeneous
@@ -29,14 +29,14 @@ def quick_sort(ARRAY):
2929
>>> quick_sort([-2, -5, -45])
3030
[-45, -5, -2]
3131
"""
32-
ARRAY_LENGTH = len(ARRAY)
33-
if( ARRAY_LENGTH <= 1):
34-
return ARRAY
32+
length = len(collection)
33+
if length <= 1:
34+
return collection
3535
else:
36-
PIVOT = ARRAY[0]
37-
GREATER = [ element for element in ARRAY[1:] if element > PIVOT ]
38-
LESSER = [ element for element in ARRAY[1:] if element <= PIVOT ]
39-
return quick_sort(LESSER) + [PIVOT] + quick_sort(GREATER)
36+
pivot = collection[0]
37+
greater = [element for element in collection[1:] if element > pivot]
38+
lesser = [element for element in collection[1:] if element <= pivot]
39+
return quick_sort(lesser) + [pivot] + quick_sort(greater)
4040

4141

4242
if __name__ == '__main__':

0 commit comments

Comments
 (0)