I was wondering if there is anything that I could do to make my code look cleaner and more descriptive for educational purposes?
def quick_sort(array, start, end):
if start < end:
pivot_index = partition(array, start, end)
quick_sort(array, start, pivot_index - 1)
quick_sort(array, pivot_index + 1, end)
def partition(array, start, end):
pivot_index = start
pivot = array[end]
for loop_index in range(start, end):
if array[loop_index] <= pivot:
array[pivot_index], array[loop_index] = array[loop_index], array[pivot_index]
pivot_index += 1
array[pivot_index], array[end] = array[end], array[pivot_index]
return pivot_index