Skip to content

Commit

Permalink
Added some other spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
alaouimehdi1995 committed Apr 6, 2017
1 parent 8d06eb2 commit 7ae9759
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions sorts/quick_sort.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand All @@ -50,5 +50,5 @@ def quick_sort(ARRAY):
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) )

0 comments on commit 7ae9759

Please sign in to comment.