My teacher often tells me that I don't take full advantage of Python capabilities, I would like to know if my implementation of Quicksort is good enough and how could I improve it, aside from doing it in-place
def quickSort(l):
if len(l) > 1:
l,iPiv = partition(l)
return quickSort(l[:iPiv]) + [l[iPiv]] + quickSort(l[iPiv+1:])
else:
return l
def partition(l):
i = 1
iPiv = 0
for j in range(1,len(l)):
if l[j] <= l[iPiv]:
l[i],l[j] = l[j],l[i]
i += 1
l[i-1],l[iPiv] = l[iPiv],l[i-1]
return l,i-1
particionar()
, but you callpartition()
. Please make up your mind? \$\endgroup\$