def partition(l, h):
i, j = l, h
while i < j:
while arr[l] > arr[i]:
i += 1
while arr[j] > arr[l] and j >= 0:
j += 1
if i < j:
arr[i], arr[j] = arr[j], arr[i]
arr[l], arr[j] = arr[j], arr[l]
return j
The time complexity of nested while loops is O(n2), the above snippet code is from Quicksort. Then how is the overall time complexity O(n log n)?