Quote:
Originariamente inviato da marco.r
Ha un bug 
occhio ai side effects
|
Onestamente mi sfugge: potresti indicarmi dove starebbe il bug? Grazie.
EDIT: penso d'aver capito.
Codice:
def QuickSort(List):
if len(List) <= 1: return List
Pivot = List.pop()
Less = filter(lambda x: x < Pivot, List)
More = filter(lambda x: x >= Pivot, List)
return QuickSort(Less) + [Pivot] + QuickSort(More)
Maledetta fretta.
EDIT2: è pure più leggibile. Meglio così.