# Python's quicksort algorithm

I was playing around with sorting methods, brushing up on my algorithms. I have made the following implementation of quicksort:

def quicksort(l):

def inner_qs(list_, start, end):
if end - start > 1:
piv = list_[end - 1]
aux_index = start
for i in range(start, end):
if list_[i] < piv or i == end - 1:
list_[aux_index], list_[i] = list_[i], list_[aux_index]
aux_index += 1
pivot_position = aux_index - 1
# left
inner_qs(list_, start=start, end=pivot_position)
# right
inner_qs(list_, start=pivot_position + 1, end=end)

l = l[:]
inner_qs(l, 0, len(l))
return l


Please, take a look at it.

• I thought it was more suitable here, since I was asking for a code review ;-) But okay. Jun 22, 2020 at 22:07
• I have edited the post title and body. Could you please take a look at my post now? Thanks for your time. Jun 22, 2020 at 22:16
• You tested this and it throws a recursion error. This means it's not ready for review. Please take a look at the help center and feel free to come back once it works.
– Mast
Jun 23, 2020 at 5:34
• Like every straightforward recursive implementation, yours needs recursion depth of n for an n element ordered input. Jun 23, 2020 at 7:13