I have separate implementations of sorting algorithms on 2 separate files (one for divide and conquer and another for brute force algos). I was trying to benchmark them against each other so I in-cooperated all of them(via imports) into a single file which generates a random list of specified length and calls all sorting functions using said list as input and displays their running time, though my problem is specifically with quicksort (NOTE: This omits several other sorting functions called in the same form):
if __name__ == '__main__':
size = int(sys.argv[1])
input_list = randomgen(size)
start = 0
end = int(len(input_list)-1)
print('Quick Sort:')
start_time = time()
quicksort(input_list, start, end)
end_time = time()
print('Run Time: ',(end_time-start_time))
When I call this function it throws a recursion depth error, specifically: 'RecursionError: maximum recursion depth exceeded in comparison' (though it works with input lists of sizes less than 100). When I try to do the same exact thing in the file containing only quick sort and merge sort with an input list of the same length it functions perfectly
So my question is: what could cause this behavior and is it advice-able to change the recursion depth of python if that's whats causing the error ?
EDIT: Turns out the error was caused by the pivoting scheme I was using(end instead of random). Thanks to @olisch for this link: Python Quicksort Maximum Recursion Depth