So here is my quicksort code
def quicksort(A):
if len(A) > 1:
pivot = A[0]
L = []
E = []
R = []
for i in A:
if i < pivot:
L.append(i)
elif i == pivot:
E.append(i)
else:
R.append(i)
quicksort(L)
quicksort(R)
A = L + E + R
And the output when I run
array = [5,6,3,2,7]
print "original array" + str(array)
quicksort(array)
print "sorted array" + str(array)
Is
original array[5, 6, 3, 2, 7]
sorted array[5, 6, 3, 2, 7]
However, when I step through the function with the debugger, the last value A ever holds is [2,3,5,6,7] which is sorted, why does A not hold this after the function is executed?