A way to use Python which I don't know
- by Konie
In this quicksort function:
def qsort2(list):
if list == []:
return []
else:
pivot = list[0]
# can't understand the following line
lesser, equal, greater = partition(list[1:], [], [pivot], [])
return qsort2(lesser) + equal + qsort2(greater)
def partition(list, l, e, g):
if list == []:
return (l, e, g)
else:
head = list[0]
if head < e[0]:
return partition(list[1:], l + [head], e, g)
elif head > e[0]:
return partition(list[1:], l, e, g + [head])
else:
return partition(list[1:], l, e + [head], g)
I don't understand the sentence below the comment. Can someone tell me what is the meaning of this sentence here?