mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-01-18 16:27:02 +00:00
Added some other spaces
This commit is contained in:
parent
8d06eb2c63
commit
7ae9759220
|
@ -29,13 +29,13 @@ def quick_sort(ARRAY):
|
|||
>>> quick_sort([-2, -5, -45])
|
||||
[-45, -5, -2]
|
||||
"""
|
||||
ARRAY_LENGTH=len(ARRAY)
|
||||
ARRAY_LENGTH = len(ARRAY)
|
||||
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]
|
||||
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)
|
||||
|
||||
|
||||
|
@ -50,5 +50,5 @@ if __name__ == '__main__':
|
|||
input_function = input
|
||||
|
||||
user_input = input_function('Enter numbers separated by a comma:\n')
|
||||
unsorted = [int(item) for item in user_input.split(',')]
|
||||
print(quick_sort(unsorted))
|
||||
unsorted = [ int(item) for item in user_input.split(',') ]
|
||||
print( quick_sort(unsorted) )
|
||||
|
|
Loading…
Reference in New Issue
Block a user