Ad
Algorithms
Logic

A quick sort algorithm.

from copy import deepcopy

def partition(l,deb,fin):
    p=deb
    pivot=l[deb]
    for k in range(deb+1,fin):
        if l[k]<pivot:
            p+=1
            l[p],l[k]=l[k],l[p]
    l[p],l[deb]=l[deb],l[p]
    return p

def Tri_Rapide(ll):
    l = deepcopy(ll)
    def tri(deb,fin):
        if deb<fin:
            p=partition(l,deb,fin)
            tri(deb,p)
            tri(p+1,fin)
    tri(0,len(l))
    return l