@@ -0,0 +1,1388 @@
+import random%0A%0A%22%22%22%0AQuicksort in python%0Aparam: list of integers%0A%22%22%22%0Adef quicksort(intList):%0A    _quicksort(intList, 0, len(intList) - 1)%0A    %0A%0A%22%22%22%0AHelper method%0Aparam: list of integers%0Aparam: index of first element to sort%0Aparam: index of last element to sort%0A%22%22%22%0Adef _quicksort(intList, first, last):%0A    if first %3C last:%0A        pivot = partition(intList, first, last) #partition and get pivot%0A        _quicksort(intList, first, pivot - 1) #sort first half%0A        _quicksort(intList, pivot + 1, last) #sort second half%0A        %0A%0A%22%22%22%0AHelper method 2%0Asummary: finds a pivot and places all the%0A        smaller items on its left and the bigger ones%0A        on it's right%0Aparam: list of integers%0Aparam: index of first element to sort%0Aparam: index of last element to sort%0A%22%22%22%0Adef partition(intList, first, last):%0A    pivot = first + random.randrange( last - first + 1) #generate pivot%0A    swap(intList, pivot, last) #put the pivot at the end%0A    %0A    #go through the range first to last%0A    for i in range(first, last):%0A        if intList%5Bi%5D %3C= intList%5Blast%5D:%0A            swap( intList, i, first )%0A            first += 1%0A%0A    swap(intList, first, last)%0A    return first%0A%0A%22%22%22%0ASimple swapping method%0A%22%22%22%0Adef swap(A, b, c):%0A    tmp = A%5Bb%5D%0A    A%5Bb%5D = A%5Bc%5D%0A    A%5Bc%5D = tmp%0A    %0A%0Ax = %5B1,6,3,6,8,3,2,6,8,9%5D%0Aprint %22Initially %7B0%7D%22.format(str(x))%0Aquicksort(x)%0Aprint %22After %7B0%7D%22.format(str(x))%0A    %0A    %0A

Create quicksort.py