Added some space before and after operators

This commit is contained in:
Mehdi ALAOUI 2017-04-06 03:44:47 +01:00
parent 183df6889b
commit 8d06eb2c63

View File

@ -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__':