We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 183df68 commit 8d06eb2Copy full SHA for 8d06eb2
sorts/quick_sort.py
@@ -30,13 +30,13 @@ def quick_sort(ARRAY):
30
[-45, -5, -2]
31
"""
32
ARRAY_LENGTH=len(ARRAY)
33
- if(ARRAY_LENGTH<=1):
+ if( ARRAY_LENGTH <= 1):
34
return ARRAY
35
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)
+ PIVOT = ARRAY[0]
+ GREATER = [element for element in ARRAY[1:] if element > PIVOT]
+ LESSER = [element for element in ARRAY[1:] if element <= PIVOT]
+ return quick_sort(LESSER) + [PIVOT] + quick_sort(GREATER)
40
41
42
if __name__ == '__main__':
0 commit comments