##I am implementing quicksort in python, but my array is not changing in result, I do not understand if the algorithm is wrong or the way I am returning the array is not correct. Please help ##
def partition(array, left, right):
x = array[right]
left_pointer = left
for right_pointer in range(left, right):
if array[right_pointer] <= x:
swap(array[right_pointer], array[left_pointer])
left_pointer += 1
swap(array[left_pointer], array[right])
return left_pointer
def swap(x, y):
x, y = y, x
return x, y
def quicksort(arr, left, right):
# print(left, right)
if left < right:
pivot = partition(arr, left, right)
quicksort(arr, left, pivot - 1)
quicksort(arr, pivot + 1, right)
return array
array = [2, 6, 5, 3, 8, 7, 1, 0]
n = len(array) - 1
print(array)
print(quicksort(array, 0, n))