mirror of
https://hub.njuu.cf/TheAlgorithms/Python.git
synced 2023-10-11 13:06:12 +08: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]
|
[-45, -5, -2]
|
||||||
"""
|
"""
|
||||||
ARRAY_LENGTH=len(ARRAY)
|
ARRAY_LENGTH=len(ARRAY)
|
||||||
if(ARRAY_LENGTH<=1):
|
if( ARRAY_LENGTH <= 1):
|
||||||
return ARRAY
|
return ARRAY
|
||||||
else:
|
else:
|
||||||
PIVOT=ARRAY[0]
|
PIVOT = ARRAY[0]
|
||||||
GREATER=[element for element in ARRAY[1:] if element>PIVOT]
|
GREATER = [element for element in ARRAY[1:] if element > PIVOT]
|
||||||
LESSER=[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)
|
return quick_sort(LESSER) + [PIVOT] + quick_sort(GREATER)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
Loading…
Reference in New Issue
Block a user