I have what should be a simple quicksort implementation, but it's returning a recursion depth exceeded error, and I'm testing it on a list of less than 30 elements. Moreover, my implementation was working on a list of 10,000 a few days ago, and the only thing I changed was moving it from a Class to a global function. Anyone see what may be causing this?
def quickSort(m, left, right):
if len(m[left:right]) <= 1:
return m
pivot = m[left]
i = left + 1
j = left + 1
for j in range(j, right):
if m[j] <= pivot:
m[j], m[i] = m[i], m[j]
i += 1
m[left], m[i-1] = m[i-1], m[left]
m = quickSort(m, left, i)
m = quickSort(m, i, right)
return m
for j in range(j, right):that can't be good (for readability for the very least)