arr = [7, 3, 5, 6, 7, 1, 8, 0, 4, 9, 6, 2]
def partitioning(arr, l, d):
pivot = 5
while l <= d:
while arr[l] < pivot:
l += 1
while arr[d] > pivot:
d -= 1
arr[l], arr[d] = arr[d], arr[l]
partitioning(arr, 0, len(arr) - 1)
print(arr)
I don't understand why when putting l <= d, when l and d become the same they stop moving and keep swapping to infinity?