mirror of
https://github.com/TheAlgorithms/Python.git
synced 2024-12-18 01:00:15 +00:00
Added some space before and after operators
This commit is contained in:
parent
183df6889b
commit
8d06eb2c63
|
@ -30,13 +30,13 @@ def quick_sort(ARRAY):
|
|||
[-45, -5, -2]
|
||||
"""
|
||||
ARRAY_LENGTH=len(ARRAY)
|
||||
if(ARRAY_LENGTH<=1):
|
||||
if( ARRAY_LENGTH <= 1):
|
||||
return ARRAY
|
||||
else:
|
||||
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)
|
||||
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)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
Loading…
Reference in New Issue
Block a user