خرید بک لینک

Vote count: 0

The code is linked here : http://ideone.com/eba7CB
I can't seem to find the error. Any help and criticism are appreciated.

ar = []

def quick(l, r):
    if (r-l) <= 1:
        retu

    pivot = ar[l]
    i = l+1
    for j in range(l+1,r):
        if ar[j] < pivot:
            ar[i],ar[j] = ar[j],ar[i]
            i+=1

    ar[i-1],ar[l] = ar[l],ar[i-1]
    # print i,j
    quick(l,i)
    quick(i+1,r)


def qSort():
    l = 0
    r = len(ar)
    quick(l,r)

ar = [4, 2, 13, 10, 7, 3]

qSort()
print ar

The output is [2, 3, 4, 10, 7, 13]

asked 36 secs ago

برچسب: نویسنده: استخدام کار تاريخ: چهارشنبه 13 مرداد 1395 ساعت: 1:31

صفحه بندی